List of usage examples for com.google.common.reflect TypeToken constructor
public final Invokable<T, T> constructor(Constructor<?> constructor)
From source file:edu.mit.streamjit.util.ConstructorSupplier.java
public ConstructorSupplier(TypeToken<T> type, Iterable<?> arguments) { this.arguments = ImmutableList.copyOf(arguments); try {/*w w w . j a v a 2 s.co m*/ this.ctor = type.constructor(ReflectionUtils.findConstructor(type.getRawType(), this.arguments)); } catch (NoSuchMethodException ex) { throw new UndeclaredThrowableException(ex); } }
From source file:edu.mit.streamjit.util.ConstructorSupplier.java
protected ConstructorSupplier(Iterable<?> arguments) { TypeToken<T> type = new TypeToken<T>(getClass()) { };/*from w w w . j av a 2s . c om*/ this.arguments = ImmutableList.copyOf(arguments); try { this.ctor = type.constructor(ReflectionUtils.findConstructor(type.getRawType(), this.arguments)); } catch (NoSuchMethodException ex) { throw new UndeclaredThrowableException(ex); } }
From source file:com.google.cloud.dataflow.sdk.util.ApiSurface.java
/** * Returns an {@link Invokable} for each public methods or constructors of a type. *///from w ww. jav a2 s. co m private Set<Invokable> getExposedInvokables(TypeToken<?> type) { Set<Invokable> invokables = Sets.newHashSet(); for (Constructor constructor : type.getRawType().getConstructors()) { if (0 != (constructor.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED))) { invokables.add(type.constructor(constructor)); } } for (Method method : type.getRawType().getMethods()) { if (0 != (method.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED))) { invokables.add(type.method(method)); } } return invokables; }