@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(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 problems.put(methodName(targetClass, types), e); } catch (NoSuchMethodException e) { // not the right implementation problems.put(methodName(targetClass, types), e); } 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); }
private void startRowGroup() { try { this.nextRowGroupSize = min(writer.getNextRowGroupSize(), targetRowGroupSize); } catch (IOException e) { throw new RuntimeIOException(e); } this.nextCheckRecordCount = min(max(recordCount / 2, 100), 10000); this.recordCount = 0; PageWriteStore pageStore = pageStoreCtor.newInstance( compressor, parquetSchema, props.getAllocator()); this.flushPageStoreToWriter = flushToWriter.bind(pageStore); this.writeStore = props.newColumnWriteStore(parquetSchema, pageStore); model.setColumnStore(writeStore); }
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; }
@Override protected R reuseOrCreate(Object reuse) { if (recordClass.isInstance(reuse)) { return recordClass.cast(reuse); } else { return ctor.newInstance(schema); } }
static SeekableInput stream(SeekableInputStream stream, long length) { if (stream instanceof DelegatingInputStream) { InputStream wrapped = ((DelegatingInputStream) stream).getDelegate(); if (avroFsInputCtor != null && fsDataInputStreamClass != null && fsDataInputStreamClass.isInstance(wrapped)) { return avroFsInputCtor.newInstance(wrapped, length); } } return new AvroInputStreamAdapter(stream, length); }
public C newInstance(Object... args) { try { return newInstanceChecked(args); } catch (Exception e) { Throwables.propagateIfInstanceOf(e, RuntimeException.class); throw Throwables.propagate(e); } }