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
ConstructorsModifierConstructorDescriptionprotected
Empty constructor for subclasses only.protected
CodeListAdapter
(CodeListUID value) Creates a wrapper for aCodeList
, in order to handle the format specified in ISO 19115-3. -
Method Summary
Modifier and TypeMethodDescriptionprotected final boolean
Returnstrue
if aSince2014
subclasses should return a non-null value.Returns the class of code list wrapped by this adapter.abstract CodeListUID
Invoked by JAXB on marshalling.protected boolean
isEnum()
Returnstrue
if this code list is actually an enum.final ValueType
Substitutes the code list by the adapter to be marshalled into an XML file or stream.final BoundType
Substitutes the adapter value read from an XML stream by the object which will contain the value.protected abstract ValueType
wrap
(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 ofCodeList
to be marshalled.
-
-
Method Details
-
wrap
Wraps the given value. Most implementations will be like below: However, is some cases, thevalue
argument may be inspected. For example,MD_RestrictionCode
replaces"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()Returnstrue
if aSince2014
subclasses should return a non-null value. This is a convenience method forFilterByVersion.CURRENT_METADATA.accept()
.- Returns:
- whether
Since2014
subclasses 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:
unmarshal
in 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:
marshal
in 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()Returnstrue
if this code list is actually an enum. The default implementation returnsfalse
in every cases, since there is very few enums in ISO 19115.- Returns:
true
if this code list is actually an enum.- See Also:
-
getElement
Invoked by JAXB on marshalling. Subclasses must override this method with the appropriate@XmlElement
annotation.- Returns:
- the
CodeList
value to be marshalled.
-