public class TLcdGML2TypeMappingAnnotation extends ALcdGMLTypeMappingAnnotation
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();
}
}
This implementation is used when mapping to and from GML 2.Constructor and Description |
---|
TLcdGML2TypeMappingAnnotation(TLcdDataType aType,
ILcdObjectTransformation aTransformation) |
public TLcdGML2TypeMappingAnnotation(TLcdDataType aType, ILcdObjectTransformation aTransformation)