Class ALcdGMLTypeMappingAnnotation
java.lang.Object
com.luciad.format.gmlcommon.transformation.ALcdGMLTypeMappingAnnotation
- All Implemented Interfaces:
ILcdAnnotation
- Direct Known Subclasses:
TLcdGML2TypeMappingAnnotation
,TLcdGML31TypeMappingAnnotation
,TLcdGML32TypeMappingAnnotation
Maps and transforms a source data type to a given (GML) target data type.
If this annotation is present on a data type, TLcdGMLTransformer will map and transform that type to and from the given target type using the given transformation.
If this annotation is present on a data type, TLcdGMLTransformer will map and transform that type to and from the given target type using the given transformation.
As an example, you could define and use a GregorianCalender type in your data model. You can map the type to an XML date type as follows:
dataModelBuilder.typeBuilder("DateType").primitive(true).instanceClass(GregorianCalendar.class);
TLcdDataModel dataModel = dataModelBuilder.createDataModel();
TLcdDataType dateType = dataModel.getDeclaredType("DateType");
dateType.addAnnotation(new TLcdGML32TypeMappingAnnotation(
TLcdXMLBuiltInDataTypes.DateTime, new ALcdObjectTransformation() {
public Object transform(Object aValue, Map<Object, Object> aContext) {
return DatatypeFactory.newInstance().newXMLGregorianCalendar((GregorianCalendar) aValue);
}
protected Object invert(Object aValue, Map<Object, Object> aContext) {
return ((XMLGregorianCalendar) aValue).toGregorianCalendar();
}
}
- Since:
- 11.0
- See Also:
-
Constructor Summary
ConstructorDescriptionALcdGMLTypeMappingAnnotation
(TLcdDataType aType, ILcdObjectTransformation aTransformation) Creates a new instance. -
Method Summary
-
Constructor Details
-
ALcdGMLTypeMappingAnnotation
Creates a new instance. The data model that declaresaType
should be annotated withTLcdXMLSchemaMappingAnnotation
andTLcdXMLSchemaTypeMappingAnnotation
such that instances can be properly marshalled from and to XML.- Parameters:
aType
- the type that is the GML representation of the type to which this annotation is addedaTransformation
- a transformation that can transform instances from the annotated type to the given type
-
-
Method Details
-
getType
Returns the GML representation of the annotated type.- Returns:
- the GML representation of the annotated type
-
getTransformation
Returns the transformation that is capable of transforming instances of the annotated type to instances ofgetType()
.- Returns:
- the transformation from annotated type to GML type
-