@Override @SuppressWarnings("unchecked") public <R> R invoke(Object target, Object... args) { Preconditions.checkArgument(target == null, "Invalid call to constructor: target must be null"); return (R) newInstance(target, args); }
public <T> Builder hiddenImpl(Class<T> targetClass, Class<?>... types) { // don't do any work if an implementation has been found if (ctor != null) { return this; } try { Constructor<T> hidden = targetClass.getDeclaredConstructor(types); AccessController.doPrivileged(new MakeAccessible(hidden)); ctor = new Ctor<T>(hidden, targetClass); } catch (SecurityException e) { // unusable } catch (NoSuchMethodException e) { // not the right implementation } return this; }
@Override @SuppressWarnings("unchecked") public <R> R invokeChecked(Object target, Object... args) throws Exception { Preconditions.checkArgument(target == null, "Invalid call to constructor: target must be null"); return (R) newInstanceChecked(args); }
.impl(transform) .buildChecked(); transformFn = ctor.newInstance(); } catch (NoSuchMethodException e) { throw new DatasetException(
.impl(transform) .buildChecked(); transformFn = ctor.newInstance(); } catch (NoSuchMethodException e) { throw new DatasetException(
.impl(transform) .buildChecked(); transformFn = ctor.newInstance(); } catch (NoSuchMethodException e) { throw new DatasetException(
.impl(transform) .buildChecked(); transformFn = ctor.newInstance(); } catch (NoSuchMethodException e) { throw new DatasetException(
public <T> Builder hiddenImpl(Class<T> targetClass, Class<?>... types) { // don't do any work if an implementation has been found if (ctor != null) { return this; } try { Constructor<T> hidden = targetClass.getDeclaredConstructor(types); AccessController.doPrivileged(new MakeAccessible(hidden)); ctor = new Ctor<T>(hidden, targetClass); } catch (SecurityException e) { // unusable problems.put(methodName(targetClass, types), e); } catch (NoSuchMethodException e) { // not the right implementation problems.put(methodName(targetClass, types), e); } return this; }
public <T> Builder impl(Class<T> targetClass, Class<?>... types) { // don't do any work if an implementation has been found if (ctor != null) { return this; } try { ctor = new Ctor<T>(targetClass.getConstructor(types), targetClass); } catch (NoSuchMethodException e) { // not the right implementation problems.put(methodName(targetClass, types), e); } return this; }
public <T> Builder impl(Class<T> targetClass, Class<?>... types) { // don't do any work if an implementation has been found if (ctor != null) { return this; } try { ctor = new Ctor<T>(targetClass.getConstructor(types), targetClass); } catch (NoSuchMethodException e) { // not the right implementation } return this; }
private static Class<?> findTypeInfoClass(String className) { try { return new DynConstructors.Builder(TypeInfo.class) .impl(className).buildChecked().getConstructedClass(); } catch (NoSuchMethodException e) { return null; } }
@Override @SuppressWarnings("unchecked") public <R> R invokeChecked(Object target, Object... args) throws Exception { Preconditions.checkArgument(target == null, "Invalid call to constructor: target must be null"); return (R) newInstanceChecked(args); }
@Override @SuppressWarnings("unchecked") public <R> R invoke(Object target, Object... args) { Preconditions.checkArgument(target == null, "Invalid call to constructor: target must be null"); return (R) newInstance(target, args); }
public C newInstance(Object... args) { try { return newInstanceChecked(args); } catch (Exception e) { throw Throwables.propagate(e); } }
public static <K, V> FileInputFormat<K, V> newInputFormatInstance( DatasetDescriptor descriptor) { DynConstructors.Ctor<FileInputFormat<K, V>> ctor = new DynConstructors.Builder() .impl(descriptor.getProperty(INPUT_FORMAT_CLASS_PROP)) .build(); return ctor.newInstance(); }
private static Configuration newHiveConf(Configuration base) { checkHiveDependencies(); // ensure HIVE_CONF is present Configuration conf = HIVE_CONF.newInstance(base, HIVE_CONF.getConstructedClass()); // Add everything in base back in to work around a bug in HiveConf HiveUtils.addResource(conf, base); return conf; }
@Test public void testSetupJobIsIdempotent() { DatasetKeyOutputFormat.MergeOutputCommitter<Object> outputCommitter = new DatasetKeyOutputFormat.MergeOutputCommitter<Object>(); Configuration conf = DefaultConfiguration.get(); DatasetKeyOutputFormat.configure(conf).appendTo(outputDataset); JobID jobId = new JobID("jt", 42); JobContext context = Hadoop.JobContext.ctor.newInstance(conf, jobId); // setup the job outputCommitter.setupJob(context); // call setup again to simulate an ApplicationMaster restart outputCommitter.setupJob(context); }
private static Configuration newHiveConf(Configuration base) { checkHiveDependencies(); // ensure HIVE_CONF is present Configuration conf = HIVE_CONF.newInstance(base, HIVE_CONF.getConstructedClass()); // Add everything in base back in to work around a bug in HiveConf HiveUtils.addResource(conf, base); return conf; }
public C newInstance(Object... args) { try { return newInstanceChecked(args); } catch (Exception e) { throw Throwables.propagate(e); } }
private static Class<?> findTypeInfoClass(String className) { try { return new DynConstructors.Builder(TypeInfo.class) .impl(className).buildChecked().getConstructedClass(); } catch (NoSuchMethodException e) { return null; } }