Class PropertyInformation<E>

java.lang.Object
org.apache.sis.internal.simple.SimpleIdentifier
org.apache.sis.metadata.PropertyInformation<E>
Type Parameters:
E - the value type, either the method return type if not a collection, or the type of elements in the collection otherwise.
All Implemented Interfaces:
Serializable, CheckedContainer<E>, Deprecable, org.opengis.metadata.ExtendedElementInformation, org.opengis.metadata.Identifier, org.opengis.referencing.ReferenceIdentifier

final class PropertyInformation<E> extends SimpleIdentifier implements org.opengis.metadata.ExtendedElementInformation, CheckedContainer<E>
Description of a metadata property inferred from Java reflection. For a given metadata instances (typically an AbstractMetadata subclasses, but other types are allowed), instances of PropertyInformation are obtained indirectly by the MetadataStandard.asInformationMap(Class, KeyNamePolicy) method.

This class implements also the Identifier and CheckedContainer interfaces. Those features are not directly used by this class, but is published in the MetadataStandard javadoc.

API note: The rational for implementing CheckedContainer is to consider each ExtendedElementInformation instance as the set of all possible values for the property. If the information had a contains(E) method, it would return true if the given value is valid for that property.

Immutability and thread safety

This final class is immutable and thus thread-safe.
Since:
0.3
Version:
0.5
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Object
    The domain of valid values, or null if none.
    private final Class<E>
    The value type, either the method return type if not a collection, or the type of elements in the collection otherwise.
    private final byte
    The maximum number of occurrences as an unsigned number.
    private final byte
    The minimum number of occurrences.
    private final Class<?>
    The interface which contain this property.
    private static final long
    For cross-versions compatibility.

    Fields inherited from class org.apache.sis.internal.simple.SimpleIdentifier

    authority, code, isDeprecated

    Fields inherited from interface org.opengis.metadata.Identifier

    AUTHORITY_KEY, CODE_KEY

    Fields inherited from interface org.opengis.referencing.ReferenceIdentifier

    CODESPACE_KEY, VERSION_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    PropertyInformation(org.opengis.metadata.citation.Citation standard, String property, Method getter, Class<E> elementType, ValueRange range)
    Creates a new PropertyInformation instance from the annotations on the given getter method.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Invoked by SimpleIdentifier.toString() in order to append additional information after the identifier.
    boolean
    Compares the given object with this element information for equality.
    final String
    Returns the ISO name of the class containing the property, or the simple class name if the ISO name is undefined.
    org.opengis.util.InternationalString
    Returns the condition under which the extended element is mandatory.
    org.opengis.metadata.Datatype
    Returns the kind of value provided in the extended element.
    final org.opengis.util.InternationalString
    Returns the definition of this property, or null if none.
    Deprecated.
    This property was defined in the 2003 edition of ISO 19115, but has been removed in the 2014 edition.
    org.opengis.util.InternationalString
    Returns valid values that can be assigned to the extended element, or null if none.
    Returns the case type of values to be stored in the property.
    Returns the maximum number of times that values are required.
    Returns the primary name by which this metadata element is identified.
    org.opengis.metadata.Obligation
    Returns the obligation of the element.
    Returns the name of the metadata entity under which this metadata element may appear.
    org.opengis.util.InternationalString
    Unconditionally returns null.
    Collection<org.opengis.util.InternationalString>
    Deprecated.
    org.opengis.util.InternationalString
    Specifies how the extended element relates to other existing elements and entities.
    Deprecated.
    This property was defined in the 2003 edition of ISO 19115, but has been removed in the 2014 edition.
    Collection<? extends org.opengis.metadata.citation.ResponsibleParty>
    Returns the name of the person or organization creating the element.
    final int
    Computes a hash code value only from the code space and property name.

    Methods inherited from class org.apache.sis.internal.simple.SimpleIdentifier

    getAuthority, getCode, getDescription, getRemarks, getVersion, isDeprecated, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-versions compatibility.
      See Also:
    • parent

      private final Class<?> parent
      The interface which contain this property.
      See Also:
    • elementType

      private final Class<E> elementType
      The value type, either the method return type if not a collection, or the type of elements in the collection otherwise.
      See Also:
    • minimumOccurs

      private final byte minimumOccurs
      The minimum number of occurrences. A minimumOccurs value of -1 means that the property is conditional, i.e. the actual minimumOccurs value can either 0 or 1 depending on the value of another property.
      See Also:
    • maximumOccurs

      private final byte maximumOccurs
      The maximum number of occurrences as an unsigned number. Value 255 (or -1 as a signed number) shall be understood as Integer.MAX_VALUE.
      See Also:
    • domainValue

      private volatile Object domainValue
      The domain of valid values, or null if none. If non-null, then this is set to an instance of ValueRange at construction time, then replaced by an instance of DomainRange when first needed by the getDomainValue() method.
      See Also:
  • Constructor Details

    • PropertyInformation

      PropertyInformation(org.opengis.metadata.citation.Citation standard, String property, Method getter, Class<E> elementType, ValueRange range)
      Creates a new PropertyInformation instance from the annotations on the given getter method.
      Parameters:
      standard - the international standard that define the property, or null if none.
      property - the property name as defined by the international standard.
      getter - the getter method defined in the interface.
      elementType - the value type, either the method return type if not a collection, or the type of elements in the collection otherwise.
      range - the range of valid values, or null if none. This information is associated to the implementation method rather than the interface one, because it is specific to SIS.
  • Method Details

    • getName

      public String getName()
      Returns the primary name by which this metadata element is identified.
      Specified by:
      getName in interface org.opengis.metadata.ExtendedElementInformation
    • getCodeSpace

      public final String getCodeSpace()
      Returns the ISO name of the class containing the property, or the simple class name if the ISO name is undefined.
      Specified by:
      getCodeSpace in interface org.opengis.referencing.ReferenceIdentifier
      Overrides:
      getCodeSpace in class SimpleIdentifier
      Returns:
      a code space inferred from the authority given at construction time, or null if none.
      See Also:
    • getShortName

      @Deprecated public String getShortName()
      Deprecated.
      This property was defined in the 2003 edition of ISO 19115, but has been removed in the 2014 edition.
      Unconditionally returns null.
      Specified by:
      getShortName in interface org.opengis.metadata.ExtendedElementInformation
    • getDomainCode

      @Deprecated public Integer getDomainCode()
      Deprecated.
      This property was defined in the 2003 edition of ISO 19115, but has been removed in the 2014 edition.
      Unconditionally returns null.
      Specified by:
      getDomainCode in interface org.opengis.metadata.ExtendedElementInformation
    • getDefinition

      public final org.opengis.util.InternationalString getDefinition()
      Returns the definition of this property, or null if none.
      Specified by:
      getDefinition in interface org.opengis.metadata.ExtendedElementInformation
    • getObligation

      public org.opengis.metadata.Obligation getObligation()
      Returns the obligation of the element.
      Specified by:
      getObligation in interface org.opengis.metadata.ExtendedElementInformation
    • getCondition

      public org.opengis.util.InternationalString getCondition()
      Returns the condition under which the extended element is mandatory. Current implementation always return null, since the condition is not yet documented programmatically.
      Specified by:
      getCondition in interface org.opengis.metadata.ExtendedElementInformation
    • getDataType

      public org.opengis.metadata.Datatype getDataType()
      Returns the kind of value provided in the extended element. This is a generic code that describe the element type. For more accurate information, see getElementType().
      Specified by:
      getDataType in interface org.opengis.metadata.ExtendedElementInformation
    • getElementType

      public Class<E> getElementType()
      Returns the case type of values to be stored in the property. If the property type is an array or a collection, then this method returns the type of elements in the array or collection.
      Specified by:
      getElementType in interface CheckedContainer<E>
      Returns:
      the element type.
      See Also:
    • getMaximumOccurrence

      public Integer getMaximumOccurrence()
      Returns the maximum number of times that values are required. This method returns 0 if the property is forbidden, Integer.MAX_VALUE if the property is an array or a collection, or 1 otherwise.
      Specified by:
      getMaximumOccurrence in interface org.opengis.metadata.ExtendedElementInformation
    • getDomainValue

      public org.opengis.util.InternationalString getDomainValue()
      Returns valid values that can be assigned to the extended element, or null if none. In the particular case of SIS implementation, this method may return a subclass of NumberRange.
      Specified by:
      getDomainValue in interface org.opengis.metadata.ExtendedElementInformation
    • getParentEntity

      public Collection<String> getParentEntity()
      Returns the name of the metadata entity under which this metadata element may appear. The name may be standard metadata element or other extended metadata element.
      Specified by:
      getParentEntity in interface org.opengis.metadata.ExtendedElementInformation
      See Also:
    • getRule

      public org.opengis.util.InternationalString getRule()
      Specifies how the extended element relates to other existing elements and entities. The current implementation always return null.
      Specified by:
      getRule in interface org.opengis.metadata.ExtendedElementInformation
    • getRationale

      public org.opengis.util.InternationalString getRationale()
      Unconditionally returns null.
    • getRationales

      @Deprecated public Collection<org.opengis.util.InternationalString> getRationales()
      Deprecated.
      Unconditionally returns an empty list.
      Specified by:
      getRationales in interface org.opengis.metadata.ExtendedElementInformation
    • getSources

      public Collection<? extends org.opengis.metadata.citation.ResponsibleParty> getSources()
      Returns the name of the person or organization creating the element.
      Specified by:
      getSources in interface org.opengis.metadata.ExtendedElementInformation
    • equals

      public boolean equals(Object obj)
      Compares the given object with this element information for equality.
      Overrides:
      equals in class SimpleIdentifier
      Parameters:
      obj - the object to compare with this element information for equality.
      Returns:
      true if both objects are equal.
    • hashCode

      public final int hashCode()
      Computes a hash code value only from the code space and property name. We don't need to use the other properties, because the fully qualified property name should be a sufficient discriminator.
      Overrides:
      hashCode in class SimpleIdentifier
      Returns:
      a hash code value for this identifier.
    • appendStringTo

      protected void appendStringTo(StringBuilder buffer)
      Invoked by SimpleIdentifier.toString() in order to append additional information after the identifier.
      Overrides:
      appendStringTo in class SimpleIdentifier
      Parameters:
      buffer - a buffer filled with the SimpleIdentifier.toString() characters, that subclasses can update.