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 Details

    • identifier

      protected CodeListUID identifier
      The value of the CodeList.
  • Constructor Details

    • CodeListAdapter

      protected CodeListAdapter()
      Empty constructor for subclasses only.
    • CodeListAdapter

      protected CodeListAdapter(CodeListUID value)
      Creates a wrapper for a CodeList, in order to handle the format specified in ISO 19115-3.
      Parameters:
      value - the value of CodeList to be marshalled.
  • Method Details

    • wrap

      protected abstract ValueType wrap(CodeListUID value)
      Wraps the given value. Most implementations will be like below: However, is some cases, the value argument may be inspected. For example, MD_RestrictionCode replaces "licence" by "license" for ISO 19115:2003 compatibility.
      Parameters:
      value - the value of CodeList, to be marshalled.
      Returns:
      the wrapper for the code list value.
    • getCodeListClass

      protected abstract Class<BoundType> getCodeListClass()
      Returns the class of code list wrapped by this adapter.
      Returns:
      the code list class.
    • accept2014

      protected final boolean accept2014()
      Returns true if a Since2014 subclasses should return a non-null value. This is a convenience method for FilterByVersion.CURRENT_METADATA.accept().
      Returns:
      whether Since2014 subclasses should return a non-null value.
    • unmarshal

      public final BoundType unmarshal(ValueType adapter)
      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 class XmlAdapter<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

      public final ValueType marshal(BoundType code)
      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 class XmlAdapter<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()
      Returns true if this code list is actually an enum. The default implementation returns false 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

      public abstract CodeListUID getElement()
      Invoked by JAXB on marshalling. Subclasses must override this method with the appropriate @XmlElement annotation.
      Returns:
      the CodeList value to be marshalled.