Package org.apache.sis.metadata
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
FieldsModifier and TypeFieldDescriptionprivate Object
The domain of valid values, ornull
if none.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
ConstructorsConstructorDescriptionPropertyInformation
(org.opengis.metadata.citation.Citation standard, String property, Method getter, Class<E> elementType, ValueRange range) Creates a newPropertyInformation
instance from the annotations on the given getter method. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendStringTo
(StringBuilder buffer) Invoked bySimpleIdentifier.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, ornull
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, ornull
if none.Returns the case type of values to be stored in the property.Returns the maximum number of times that values are required.getName()
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 returnsnull
.Collection<org.opengis.util.InternationalString>
Deprecated.org.opengis.util.InternationalString
getRule()
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
hashCode()
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
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-versions compatibility.- See Also:
-
parent
The interface which contain this property.- See Also:
-
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 minimumOccursThe minimum number of occurrences. AminimumOccurs
value of -1 means that the property is conditional, i.e. the actualminimumOccurs
value can either 0 or 1 depending on the value of another property.- See Also:
-
maximumOccurs
private final byte maximumOccursThe maximum number of occurrences as an unsigned number. Value 255 (or -1 as a signed number) shall be understood asInteger.MAX_VALUE
.- See Also:
-
domainValue
The domain of valid values, ornull
if none. If non-null, then this is set to an instance ofValueRange
at construction time, then replaced by an instance ofDomainRange
when first needed by thegetDomainValue()
method.- See Also:
-
-
Constructor Details
-
PropertyInformation
PropertyInformation(org.opengis.metadata.citation.Citation standard, String property, Method getter, Class<E> elementType, ValueRange range) Creates a newPropertyInformation
instance from the annotations on the given getter method.- Parameters:
standard
- the international standard that define the property, ornull
if none.property
- the property name as defined by the internationalstandard
.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, ornull
if none. This information is associated to the implementation method rather than the interface one, because it is specific to SIS.
-
-
Method Details
-
getName
Returns the primary name by which this metadata element is identified.- Specified by:
getName
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
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 interfaceorg.opengis.referencing.ReferenceIdentifier
- Overrides:
getCodeSpace
in classSimpleIdentifier
- Returns:
- a code space inferred from the authority given at construction time, or
null
if none. - See Also:
-
getShortName
Deprecated.This property was defined in the 2003 edition of ISO 19115, but has been removed in the 2014 edition.Unconditionally returnsnull
.- Specified by:
getShortName
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
getDomainCode
Deprecated.This property was defined in the 2003 edition of ISO 19115, but has been removed in the 2014 edition.Unconditionally returnsnull
.- Specified by:
getDomainCode
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
getDefinition
public final org.opengis.util.InternationalString getDefinition()Returns the definition of this property, ornull
if none.- Specified by:
getDefinition
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
getObligation
public org.opengis.metadata.Obligation getObligation()Returns the obligation of the element.- Specified by:
getObligation
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
getCondition
public org.opengis.util.InternationalString getCondition()Returns the condition under which the extended element is mandatory. Current implementation always returnnull
, since the condition is not yet documented programmatically.- Specified by:
getCondition
in interfaceorg.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, seegetElementType()
.- Specified by:
getDataType
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
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 interfaceCheckedContainer<E>
- Returns:
- the element type.
- See Also:
-
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 interfaceorg.opengis.metadata.ExtendedElementInformation
-
getDomainValue
public org.opengis.util.InternationalString getDomainValue()Returns valid values that can be assigned to the extended element, ornull
if none. In the particular case of SIS implementation, this method may return a subclass ofNumberRange
.- Specified by:
getDomainValue
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
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 interfaceorg.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 returnnull
.- Specified by:
getRule
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
getRationale
public org.opengis.util.InternationalString getRationale()Unconditionally returnsnull
. -
getRationales
Deprecated.Unconditionally returns an empty list.- Specified by:
getRationales
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
getSources
Returns the name of the person or organization creating the element.- Specified by:
getSources
in interfaceorg.opengis.metadata.ExtendedElementInformation
-
equals
Compares the given object with this element information for equality.- Overrides:
equals
in classSimpleIdentifier
- 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 classSimpleIdentifier
- Returns:
- a hash code value for this identifier.
-
appendStringTo
Invoked bySimpleIdentifier.toString()
in order to append additional information after the identifier.- Overrides:
appendStringTo
in classSimpleIdentifier
- Parameters:
buffer
- a buffer filled with theSimpleIdentifier.toString()
characters, that subclasses can update.
-