Package org.apache.sis.internal.jaxb.cat
Class CodeListAdapter<ValueType extends CodeListAdapter<ValueType,BoundType>,BoundType extends org.opengis.util.CodeList<BoundType>>
java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<ValueType,BoundType>
org.apache.sis.internal.jaxb.cat.CodeListAdapter<ValueType,BoundType>
- Type Parameters:
ValueType- The subclass implementing this adapter.BoundType- The code list being adapted.
- Direct Known Subclasses:
CI_DateTypeCode,CI_OnLineFunctionCode,CI_PresentationFormCode,CI_RoleCode,DQ_EvaluationMethodTypeCode,DS_AssociationTypeCode,DS_InitiativeTypeCode,MD_CellGeometryCode,MD_ClassificationCode,MD_CoverageContentTypeCode,MD_DatatypeCode,MD_DimensionNameTypeCode,MD_GeometricObjectTypeCode,MD_ImagingConditionCode,MD_KeywordTypeCode,MD_MaintenanceFrequencyCode,MD_MediumFormatCode,MD_MediumNameCode,MD_PixelOrientationCode,MD_ProgressCode,MD_RestrictionCode,MD_ScopeCode,MD_SpatialRepresentationTypeCode,MD_TopicCategoryCode,MD_TopologyLevelCode,MI_BandDefinition,MI_ContextCode,MI_GeometryTypeCode,MI_ObjectiveTypeCode,MI_OperationTypeCode,MI_PolarisationOrientationCode,MI_PriorityCode,MI_SequenceCode,MI_TransferFunctionTypeCode,MI_TriggerCode
public abstract class CodeListAdapter<ValueType extends CodeListAdapter<ValueType,BoundType>,BoundType extends org.opengis.util.CodeList<BoundType>>
extends XmlAdapter<ValueType,BoundType>
An adapter for
CodeList, in order to implement the ISO 19115-3 standard.
This object wraps a CodeListUID, which contain codeList
and codeListValue attributes. The result looks like below:
A subclass must exist for each code list, with a getElement() method having a
@XmlElement annotation.- Since:
- 0.3
- Version:
- 1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEmpty constructor for subclasses only.protectedCodeListAdapter(CodeListUID value) Creates a wrapper for aCodeList, in order to handle the format specified in ISO 19115-3. -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanReturnstrueif aSince2014subclasses should return a non-null value.Returns the class of code list wrapped by this adapter.abstract CodeListUIDInvoked by JAXB on marshalling.protected booleanisEnum()Returnstrueif this code list is actually an enum.final ValueTypeSubstitutes the code list by the adapter to be marshalled into an XML file or stream.final BoundTypeSubstitutes the adapter value read from an XML stream by the object which will contain the value.protected abstract ValueTypewrap(CodeListUID value) Wraps the given value.
-
Field Details
-
identifier
The value of theCodeList.
-
-
Constructor Details
-
CodeListAdapter
protected CodeListAdapter()Empty constructor for subclasses only. -
CodeListAdapter
Creates a wrapper for aCodeList, in order to handle the format specified in ISO 19115-3.- Parameters:
value- the value ofCodeListto be marshalled.
-
-
Method Details
-
wrap
Wraps the given value. Most implementations will be like below: However, is some cases, thevalueargument may be inspected. For example,MD_RestrictionCodereplaces"licence"by"license"for ISO 19115:2003 compatibility.- Parameters:
value- the value ofCodeList, to be marshalled.- Returns:
- the wrapper for the code list value.
-
getCodeListClass
Returns the class of code list wrapped by this adapter.- Returns:
- the code list class.
-
accept2014
protected final boolean accept2014()Returnstrueif aSince2014subclasses should return a non-null value. This is a convenience method forFilterByVersion.CURRENT_METADATA.accept().- Returns:
- whether
Since2014subclasses should return a non-null value.
-
unmarshal
Substitutes the adapter value read from an XML stream by the object which will contain the value. JAXB calls automatically this method at unmarshalling time.- Specified by:
unmarshalin classXmlAdapter<ValueType extends CodeListAdapter<ValueType,BoundType>, BoundType extends org.opengis.util.CodeList<BoundType>> - Parameters:
adapter- the adapter for this metadata value.- Returns:
- a code list which represents the metadata value.
-
marshal
Substitutes the code list by the adapter to be marshalled into an XML file or stream. JAXB calls automatically this method at marshalling time.- Specified by:
marshalin classXmlAdapter<ValueType extends CodeListAdapter<ValueType,BoundType>, BoundType extends org.opengis.util.CodeList<BoundType>> - Parameters:
code- the code list value.- Returns:
- the adapter for the given code list.
-
isEnum
protected boolean isEnum()Returnstrueif this code list is actually an enum. The default implementation returnsfalsein every cases, since there is very few enums in ISO 19115.- Returns:
trueif this code list is actually an enum.- See Also:
-
getElement
Invoked by JAXB on marshalling. Subclasses must override this method with the appropriate@XmlElementannotation.- Returns:
- the
CodeListvalue to be marshalled.
-