Package org.tensorics.core.util
Class SingleArgumentInvokableInstantiator<A,R>
- java.lang.Object
-
- org.tensorics.core.util.SingleArgumentInvokableInstantiator<A,R>
-
- Type Parameters:
A
- the type of the constructor argumentR
- the type of the resulting instance
- All Implemented Interfaces:
Instantiator<A,R>
- Direct Known Subclasses:
SingleArgumentConstructorInstantiator
,SingleArgumentFactoryMethodInstantiator
public abstract class SingleArgumentInvokableInstantiator<A,R> extends java.lang.Object implements Instantiator<A,R>
Can instantiate a certain type of classes, which expect exactly one argument of a certain type in the constructor.This class is immutable and thus reusable and thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Class<R>
instanceClass
-
Constructor Summary
Constructors Constructor Description SingleArgumentInvokableInstantiator(java.lang.Class<R> instanceClass, java.lang.Class<A> constructorArgumentClass)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <A1 extends A>
Rcreate(A1 argument)
Creates an instance, using the given argument.protected abstract com.google.common.reflect.Invokable<R,R>
invokableFor(java.lang.Class<A> constructorArgumentClass)
-
-
-
Field Detail
-
instanceClass
protected final java.lang.Class<R> instanceClass
-
-
Method Detail
-
create
public <A1 extends A> R create(A1 argument)
Description copied from interface:Instantiator
Creates an instance, using the given argument.- Specified by:
create
in interfaceInstantiator<A,R>
- Parameters:
argument
- the argument used to create the new instance- Returns:
- an instance of the respective type
-
-