public class InstantiatorSignature
extends java.lang.Object
Instantiator
s that match the signature or instances directly.Constructor and Description |
---|
InstantiatorSignature(java.lang.String signature,
java.util.Map<java.lang.String,?> namedInstances)
Creates a new instance of ParsedSignature.
|
Modifier and Type | Method and Description |
---|---|
<T> T |
create(java.lang.Class<? extends T> checkClass,
java.util.Map<java.lang.String,?> namedInstances)
Creates an instance for the parsed signature.
|
static <E> E |
createInstanceWithStringArgs(java.lang.String signature,
java.lang.Class<E> checkClass,
java.util.Map<java.lang.String,?> namedInstances)
Creates a new instance of a class with a string constructor/factory-method/static-field signature.
|
<T> Instantiator<T> |
createInstantiator(java.lang.Class<? extends T> checkClass)
Creates instantiator for the parsed signature.
|
java.lang.String[] |
getParsedArgs()
Return arguments parsed by this signature.
|
java.lang.Class<?> |
getParsedClass()
Returns the parsed declaring class of the constructor/method/field.
|
<T> java.lang.Class<T> |
getParsedClass(java.lang.Class<? extends T> checkClass)
Returns the parsed declaring class of the constructor/method/field.
|
java.lang.String |
getParsedName()
Returns the parsed name of the method/field.
|
boolean |
isConstructorSignature()
Returns true if a constructor signature was parsed.
|
boolean |
isFieldSignature()
Returns true if a field signature was parsed.
|
boolean |
isMethodSignature()
Returns true if a method signature was parsed.
|
public InstantiatorSignature(java.lang.String signature, java.util.Map<java.lang.String,?> namedInstances)
signature
- a fully specified constructor/method/field signaturenamedInstances
- map of named instances - an instance from this map is returned if the string
matches a key in the mappublic java.lang.String[] getParsedArgs()
public java.lang.Class<?> getParsedClass()
public <T> java.lang.Class<T> getParsedClass(java.lang.Class<? extends T> checkClass)
checkClass
.T
- the super class of the declaring class agains which to checkcheckClass
- the super class of the declaring class agains which to checkpublic java.lang.String getParsedName()
public boolean isConstructorSignature()
public boolean isMethodSignature()
public boolean isFieldSignature()
public <T> T create(java.lang.Class<? extends T> checkClass, java.util.Map<java.lang.String,?> namedInstances) throws NoSuchInstantiatorException, java.lang.reflect.InvocationTargetException
T
- the class of the instance that will be createdcheckClass
- the class of the instance that will be creatednamedInstances
- map of named instances - an instance from this map is returned if the string
matches a key in the mapNoSuchInstantiatorException
- if the instantiator cannot be createdjava.lang.reflect.InvocationTargetException
- if there was an exception during instantiationpublic <T> Instantiator<T> createInstantiator(java.lang.Class<? extends T> checkClass) throws NoSuchInstantiatorException
T
- the class of instances that will be created by the returned instantiatorcheckClass
- the class of instances that will be created by the returned instantiatorNoSuchInstantiatorException
- if the instantiator cannot be createdpublic static <E> E createInstanceWithStringArgs(java.lang.String signature, java.lang.Class<E> checkClass, java.util.Map<java.lang.String,?> namedInstances) throws java.lang.reflect.InvocationTargetException, NoSuchInstantiatorException
messif.pivotselection.StreamSequencePivotChooser(messif.objects.impl.MetaObjectMap, file)Or the string can be a fully specified name of a factory method (package.class.methodName) with arguments enclosed by parenthesis, e.g.:
messif.utility.ExtendedProperties.getProperties(file)Or the string can be a fully specified name of a public static field (package.class.fieldName), e.g.:
messif.buckets.index.LocalAbstractObjectOrder.locatorToLocalObjectComparator
Note that only types convertible by Convert.stringToType(java.lang.String, java.lang.Class<E>, java.util.Map<java.lang.String, ? extends java.lang.Object>)
method can be used in arguments.
E
- the type of the instantiated objectsignature
- constructor or factory method call with string arguments or a static fieldcheckClass
- the superclass of (or the same class as) the instantiated objectnamedInstances
- map of named instances - an instance from this map is returned if the string
matches a key in the mapjava.lang.reflect.InvocationTargetException
- if the constructor/factory-method/static-field can't be found for the specified arguments,
the argument string-to-type convertion has failed or
there was an error during instantiationNoSuchInstantiatorException
- if the class in the constructor signature was not found or is not a descendant of checkClass