T
- the class of the objects created by this extractorpublic class TextParametricConstructorConvertor<T extends MetaObjectParametric> extends java.lang.Object implements Convertor<MetaObjectParametric,T>
Convertor
that gets the data from the
parameters of the extracted object and constructs the object using Map
constructor.
Note that the extracted class T
must have a public constructor with the following parameters:
public X(AbstractObjectKey objectKey, Map<String, ? extends Serializable> additionalParameters, Map<String, ? extends LocalAbstractObject> objectMap)
Constructor and Description |
---|
TextParametricConstructorConvertor(java.lang.String[] textParameterNames,
java.lang.Class<? extends T> objectClass,
java.lang.String keywordObjectMetaName,
boolean removeKeywordParameters,
boolean removeAllParameters,
TextDescriptorFactory<?> textDescriptorFactory)
Creates a new TextParametricConstructorExtractor that uses the
parameters from
the object generated by the encapsulated extractor to create a text descriptor object
and then merges the data into a new instance of objectClass . |
Modifier and Type | Method and Description |
---|---|
T |
convert(MetaObjectParametric object)
Converts
value to another type. |
java.lang.Class<? extends T> |
getDestinationClass()
Returns the class that this convertor converts to.
|
protected java.lang.String[] |
objectToStrings(MetaObjectParametric object)
Retrieves textual information from the object parameters.
|
public TextParametricConstructorConvertor(java.lang.String[] textParameterNames, java.lang.Class<? extends T> objectClass, java.lang.String keywordObjectMetaName, boolean removeKeywordParameters, boolean removeAllParameters, TextDescriptorFactory<?> textDescriptorFactory) throws java.lang.NoSuchMethodException
parameters
from
the object generated by the encapsulated extractor to create a text descriptor object
and then merges the data into a new instance of objectClass
.textParameterNames
- the parameter
names of the initial object that contains the textual dataobjectClass
- the class of the objects created by this extractorkeywordObjectMetaName
- the name of the metaobject
object that will hold the text descriptorremoveKeywordParameters
- flag whether to remove the text parameters
when the new object is created (true),
or pass all the parameters
from the original object without modificationsremoveAllParameters
- flag whether to remove all parameters
when the new object is created (true)textDescriptorFactory
- the factory for creating textual descriptors from textjava.lang.NoSuchMethodException
- if the given object class does not have a proper public constructorprotected java.lang.String[] objectToStrings(MetaObjectParametric object)
object
- the parametric object to get the parameters frompublic T convert(MetaObjectParametric object) throws java.lang.Exception
Convertor
value
to another type.convert
in interface Convertor<MetaObjectParametric,T extends MetaObjectParametric>
object
- the value to convertjava.lang.Exception
- if there was a conversion errorpublic java.lang.Class<? extends T> getDestinationClass()
Convertor
getDestinationClass
in interface Convertor<MetaObjectParametric,T extends MetaObjectParametric>