Class MetadataStandard
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
StandardImplementation
org.opengis.metadata
package and sub-packages.
This class provides some methods operating on metadata instances through Java reflection. The following rules are assumed:
- Metadata properties are defined by the collection of following getter methods found
in the interface, ignoring implementation methods:
get*()
methods with arbitrary return type;- or
is*()
methods with boolean return type.
- All properties are readable.
- A property is also writable if a
set*(…)
method is defined in the implementation class for the corresponding getter method. The setter method does not need to be defined in the interface.
MetadataStandard
is associated to every AbstractMetadata
objects.
The AbstractMetadata
base class usually form the basis of ISO 19115 implementations but
can also be used for other standards.
Defining new MetadataStandard
instances
Users should use the predefined constants when applicable.
However if new instances need to be defined, then there is a choice:
- For read-only metadata,
MetadataStandard
can be instantiated directly. Only getter methods will be used and all operations that modify the metadata properties will throw anUnmodifiableMetadataException
. - For read/write metadata, the
getImplementation(Class)
method must be overridden in aMetadataStandard
subclass.
Thread safety
The sameMetadataStandard
instance can be safely used by many threads without synchronization
on the part of the caller. Subclasses shall make sure that any overridden methods remain safe to call
from multiple threads, because the same MetadataStandard
instances are typically referenced
by a large amount of ModifiableMetadata
.- Since:
- 0.3
- Version:
- 1.3
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentMap<CacheKey,
Object> Accessors for the specified implementation classes.(package private) final org.opengis.metadata.citation.Citation
Bibliographical reference to the international standard.private final MetadataStandard[]
The dependencies, ornull
if none.(package private) static final boolean
true
if implementations can alter the API defined in the interfaces by adding or removing properties.(package private) static final MetadataStandard[]
Metadata instances defined in this class.(package private) final String
The root package for metadata interfaces.static final MetadataStandard
An instance working on ISO 19111 standard as defined by GeoAPI interfaces in theorg.opengis.referencing
package and sub-packages.static final MetadataStandard
An instance working on ISO 19115 standard as defined by GeoAPI interfaces in theorg.opengis.metadata
package and sub-packages, exceptquality
.static final MetadataStandard
An instance working on ISO 19123 standard as defined by GeoAPI interfaces in theorg.opengis.coverage
package and sub-packages.static final MetadataStandard
An instance working on ISO 19157 standard as defined by GeoAPI interfaces in theorg.opengis.metadata.quality
package.private static final long
For cross-version compatibility. -
Constructor Summary
ConstructorsConstructorDescriptionMetadataStandard
(String citation, String interfacePackage, MetadataStandard... dependencies) Creates a new instance working on implementation of interfaces defined in the specified package.MetadataStandard
(org.opengis.metadata.citation.Citation citation, Package interfacePackage, MetadataStandard... dependencies) Creates a new instance working on implementation of interfaces defined in the specified package. -
Method Summary
Modifier and TypeMethodDescriptionasIndexMap
(Class<?> type, KeyNamePolicy keyPolicy) Returns indices for all properties defined in the given metadata type.asInformationMap
(Class<?> type, KeyNamePolicy keyPolicy) Returns information about all properties defined in the given metadata type.asNameMap
(Class<?> type, KeyNamePolicy keyPolicy, KeyNamePolicy valuePolicy) Returns the names of all properties defined in the given metadata type.asTreeTable
(Object metadata, Class<?> baseType, ValueExistencePolicy valuePolicy) Returns the specified metadata object as a tree table.asTypeMap
(Class<?> type, KeyNamePolicy keyPolicy, TypeValuePolicy valuePolicy) Returns the type of all properties, or their declaring type, defined in the given metadata type.asValueMap
(Object metadata, Class<?> baseType, KeyNamePolicy keyPolicy, ValueExistencePolicy valuePolicy) Returns a view of the specified metadata object as aMap
.(package private) static void
Clears the cache of accessors.private CacheKey
createCacheKey
(Class<?> type) Returns a key for use ingetAccessor(CacheKey, boolean)
for the given type.boolean
equals
(Object metadata1, Object metadata2, ComparisonMode mode) Compares the two specified metadata objects.private Class<?>
findInterface
(CacheKey key) Returns the metadata interface implemented by the specified implementation.static MetadataStandard
Returns the metadata standard for the given class.(package private) final PropertyAccessor
getAccessor
(CacheKey key, boolean mandatory) Returns the accessor for the specified implementation class, ornull
if none.org.opengis.metadata.citation.Citation
Returns a bibliographical reference to the international standard.<T> Class<? extends T>
getImplementation
(Class<T> type) Returns the implementation class for the given interface, ornull
if none.<T> Class<? super T>
getInterface
(Class<T> type) Returns the metadata interface implemented by the specified implementation class.(package private) final <T> Class<? super T>
getInterface
(CacheKey key) Implementation ofgetInterface(Class)
with the possibility to specify the property type.private void
getInterfaces
(Class<?> type, Class<?> propertyType, Collection<Class<?>> interfaces) Puts every interfaces for the given type in the specified collection.(package private) final Object
Returns a value of the "title" property of the given metadata object.int
Computes a hash code for the specified metadata.boolean
isMetadata
(Class<?> type) Returnstrue
if the given type is assignable to a type from this standard or one of its dependencies.private boolean
isMetadata
(CacheKey key) Implementation ofisMetadata(Class)
with the possibility to specify the property type.(package private) boolean
isPendingAPI
(Class<?> type) Returnstrue
if the given implementation class, normally rejected byfindInterface(CacheKey)
, should be accepted as a pseudo-interface.(package private) final boolean
isSupported
(String classname) Returnstrue
if class or interface of the given name is supported by this standard.private void
Invoked during deserialization for restoring the transient fields.(package private) static <T extends MetadataStandard>
voidsetMapForField
(Class<T> classe, T instance, String name) Assigns aConcurrentMap
instance to the given field.toString()
Returns a string representation of this metadata standard.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor cross-version compatibility.- See Also:
-
IMPLEMENTATION_CAN_ALTER_API
static final boolean IMPLEMENTATION_CAN_ALTER_APItrue
if implementations can alter the API defined in the interfaces by adding or removing properties. Iftrue
, thenPropertyAccessor
will check forDeprecated
andUML
annotations in the implementation classes in addition to the interfaces.A value of
true
is useful when Apache SIS implements a newer standard than GeoAPI, but have a slight performance cost at construction time. Performance after construction should be the same.- See Also:
-
INSTANCES
Metadata instances defined in this class. Standards will be tested in the order they appear in this array. So ifisSupported(String)
may returntrue
for two or more standards, the standard which should have precedence should be declared first.The current implementation does not yet contains the user-defined instances. However, it may be something that we will need to do in the future.
-
ISO_19115
An instance working on ISO 19115 standard as defined by GeoAPI interfaces in theorg.opengis.metadata
package and sub-packages, exceptquality
. -
ISO_19157
An instance working on ISO 19157 standard as defined by GeoAPI interfaces in theorg.opengis.metadata.quality
package.- Since:
- 1.3
-
ISO_19111
An instance working on ISO 19111 standard as defined by GeoAPI interfaces in theorg.opengis.referencing
package and sub-packages. -
ISO_19123
An instance working on ISO 19123 standard as defined by GeoAPI interfaces in theorg.opengis.coverage
package and sub-packages. -
citation
final org.opengis.metadata.citation.Citation citationBibliographical reference to the international standard.- See Also:
-
interfacePackage
The root package for metadata interfaces. Must have a trailing'.'
. -
dependencies
The dependencies, ornull
if none. If non-null, dependencies will be tested in the order they appear in this array. Consequently, ifisMetadata(Class)
may returntrue
for two or more dependencies, then the dependency which should have precedence should be declared first.Note: the
null
value is for serialization compatibility. -
accessors
Accessors for the specified implementation classes. The only legal value types are:MetadataStandard
if type is handled by dependencies rather than this standard.Class
if we found the interface for the type but did not yet created thePropertyAccessor
.PropertyAccessor
otherwise.
-
-
Constructor Details
-
MetadataStandard
public MetadataStandard(org.opengis.metadata.citation.Citation citation, Package interfacePackage, MetadataStandard... dependencies) Creates a new instance working on implementation of interfaces defined in the specified package. If thisMetadataStandard
does not support a given class, then the dependencies will be tested in the order declared to this constructor. Consequently, ifisMetadata(Class)
may returntrue
for two or more dependencies, then the dependency which should have precedence should be declared first.Example:: For the ISO 19157 standard reflected by GeoAPI interfaces,interfacePackage
shall be theorg.opengis.metadata.quality
package. Its dependency isISO_19115
in theorg.opengis.metadata
package.- Parameters:
citation
- bibliographical reference to the international standard.interfacePackage
- the root package for metadata interfaces.dependencies
- the dependencies to other metadata standards.
-
MetadataStandard
MetadataStandard(String citation, String interfacePackage, MetadataStandard... dependencies) Creates a new instance working on implementation of interfaces defined in the specified package. This constructor is used only for the predefined constants.- Parameters:
citation
- bibliographical reference to the international standard.interfacePackage
- the root package for metadata interfaces.dependencies
- the dependencies to other metadata standards, ornull
if none.
-
-
Method Details
-
isSupported
Returnstrue
if class or interface of the given name is supported by this standard. This method verifies if the class is a member of the package given at construction time or a sub-package. This method does not verify if the type is supported by a dependency.- Parameters:
classname
- the name of the type to verify.- Returns:
true
if the given type is supported by this standard.
-
forClass
Returns the metadata standard for the given class. The argument given to this method can be either an interface defined by the standard, or a class implementing such interface. If the class implements more than one interface, then the first interface recognized by this method, in declaration order, will be retained.The current implementation recognizes only the standards defined by the public static constants defined in this class. A future SIS version may recognize user-defined constants.
- Parameters:
type
- the metadata standard interface, or an implementation class.- Returns:
- the metadata standard for the given type, or
null
if not found.
-
clearCache
static void clearCache()Clears the cache of accessors. This method is invoked when the classpath changed, in order to discard the references to classes that may need to be unloaded. -
getCitation
public org.opengis.metadata.citation.Citation getCitation()Returns a bibliographical reference to the international standard. The default implementation return the citation given at construction time.- Returns:
- bibliographical reference to the international standard.
-
createCacheKey
Returns a key for use ingetAccessor(CacheKey, boolean)
for the given type. The type may be an interface (typically a GeoAPI interface) or an implementation class. -
getAccessor
Returns the accessor for the specified implementation class, ornull
if none. The given class shall not be the standard interface, unless the metadata is read-only. More specifically, the giventype
shall be one of the following:- The value of
metadata.getClass()
; - The value of
getImplementation(Class)
after check for non-null value.
- Parameters:
key
- the implementation class together with the type declared by the property.mandatory
- whether this method shall throw an exception or returnnull
if no accessor is found for the given implementation class.- Returns:
- the accessor for the given implementation, or
null
if the given class does not implement a metadata interface of the expected package andmandatory
isfalse
. - Throws:
ClassCastException
- if the specified class does not implement a metadata interface of the expected package andmandatory
istrue
.
- The value of
-
isMetadata
Returnstrue
if the given type is assignable to a type from this standard or one of its dependencies. If this method returnstrue
, then invokinggetInterface(Class)
is guaranteed to succeed without throwing an exception.- Parameters:
type
- the implementation class (can benull
).- Returns:
true
if the given class is an interface of this standard, or implements an interface of this standard.
-
isMetadata
Implementation ofisMetadata(Class)
with the possibility to specify the property type. We do not provide the additional functionality of this method in public API on the assumption that if the user know the base metadata type implemented by the value, then (s)he already know that the value is a metadata instance.- See Also:
-
isPendingAPI
Returnstrue
if the given implementation class, normally rejected byfindInterface(CacheKey)
, should be accepted as a pseudo-interface. We use this undocumented feature when Apache SIS experiments a new API which is not yet published in GeoAPI. This happen for example when upgrading Apache SIS public API from the ISO 19115:2003 standard to the ISO 19115:2014 version, but GeoAPI interfaces are still the old version. In such case, API that would normally be present in GeoAPI interfaces are temporarily available only in Apache SIS implementation classes. -
findInterface
Returns the metadata interface implemented by the specified implementation. Only one metadata interface can be implemented. If the given type is already an interface from the standard, then it is returned directly.If the given class is the return value of a property, then the type of that property should be specified in the
key.propertyType
argument. This information allows this method to take in account only types that are assignable topropertyType
, so we can handle classes that implement many metadata interfaces. For example, theorg.apache.sis.internal.simple
package have various examples of implementing more than one interface for convenience.This method ignores dependencies. Fallback on metadata standard dependencies shall be done by the caller.
- Parameters:
key
- the standard interface or the implementation class.- Returns:
- the single interface, or
null
if none where found.
-
getInterfaces
Puts every interfaces for the given type in the specified collection. This method invokes itself recursively for scanning parent interfaces.If the given class is the return value of a property, then the type of that property should be specified in the
propertyType
argument. This information allows this method to take in account only the types that are assignable topropertyType
, so we can handle classes that implement many metadata interfaces. For example, theorg.apache.sis.internal.simple
package have various examples of implementing more than one interface for convenience.- See Also:
-
getInterface
Returns the metadata interface implemented by the specified implementation class. If the given type is already an interface from this standard, then it is returned unchanged.Note: The word "interface" may be taken in a looser sense than the usual Java sense because if the given type is defined in this standard package, then it is returned unchanged. The standard package is usually made of interfaces and code lists only, but this is not verified by this method.- Type Parameters:
T
- the compile-timetype
.- Parameters:
type
- the implementation class.- Returns:
- the interface implemented by the given implementation class.
- Throws:
ClassCastException
- if the specified implementation class does not implement an interface of this standard.- See Also:
-
getInterface
Implementation ofgetInterface(Class)
with the possibility to specify the property type. We do not provide the additional functionality of this method in public API on the assumption that users who want to invoke agetInterface(…)
method does not know what that interface is. In Apache SIS case, we invoke this method when we almost know what the interface is but want to check if the actual value is a subtype.- Throws:
ClassCastException
- See Also:
-
getImplementation
Returns the implementation class for the given interface, ornull
if none. If non-null, the returned class must have a public no-argument constructor and the metadata instance created by that constructor must be initially empty (no default value). That no-argument constructor should never throw any checked exception.The default implementation returns
null
in every cases. Subclasses shall override this method in order to map GeoAPI interfaces to their implementation.- Type Parameters:
T
- the compile-timetype
.- Parameters:
type
- the interface, typically from theorg.opengis.metadata
package.- Returns:
- the implementation class, or
null
if none.
-
getTitle
Returns a value of the "title" property of the given metadata object. The title property is defined byTitleProperty
annotation on the implementation class.- Parameters:
metadata
- the metadata for which to get the title property, ornull
.- Returns:
- the title property value of the given metadata, or
null
if none. - See Also:
-
asNameMap
public Map<String,String> asNameMap(Class<?> type, KeyNamePolicy keyPolicy, KeyNamePolicy valuePolicy) throws ClassCastException Returns the names of all properties defined in the given metadata type. The property names appears both as keys and as values, but may be written differently. The names may be standard identifiers (e.g. as defined by ISO 19115), JavaBeans names, method names or sentences (usually in English).Example: The following code printsThe"alternateTitles"
(note the plural):keyPolicy
argument specify only the string representation of keys returned by the iterators. No matter the key name policy, thekey
argument given to anyMap
method can be any of the above-cited forms of property names.- Parameters:
type
- the interface or implementation class of a metadata.keyPolicy
- determines the string representation of map keys.valuePolicy
- determines the string representation of map values.- Returns:
- the names of all properties defined by the given metadata type.
- Throws:
ClassCastException
- if the specified interface or implementation class does not extend or implement a metadata interface of the expected package.
-
asTypeMap
public Map<String,Class<?>> asTypeMap(Class<?> type, KeyNamePolicy keyPolicy, TypeValuePolicy valuePolicy) throws ClassCastException Returns the type of all properties, or their declaring type, defined in the given metadata type. The keys in the returned map are the same than the keys in the above name map. The values are determined by thevaluePolicy
argument, which can be element type or the declaring interface among others.Example: the following code prints theInternationalString
class name:- Parameters:
type
- the interface or implementation class of a metadata.keyPolicy
- determines the string representation of map keys.valuePolicy
- whether the values shall be property types, the element types (same as property types except for collections) or the declaring interface or class.- Returns:
- the types or declaring type of all properties defined in the given metadata type.
- Throws:
ClassCastException
- if the specified interface or implementation class does not extend or implement a metadata interface of the expected package.
-
asInformationMap
public Map<String,org.opengis.metadata.ExtendedElementInformation> asInformationMap(Class<?> type, KeyNamePolicy keyPolicy) throws ClassCastException Returns information about all properties defined in the given metadata type. The keys in the returned map are the same than the keys in the above name map. The values contain information inferred from the ISO names, theObligation
enumeration and theValueRange
annotations.In the particular case of Apache SIS implementation, all values in the information map additionally implement the following interfaces:
ReferenceIdentifier
with the following properties:- The authority is this metadata standard citation.
- The codespace is the standard name of the interface that contain the property.
- The code is the standard name of the property.
CheckedContainer
with the following properties:- The element type is the type of property values
as defined by
TypeValuePolicy.ELEMENT_TYPE
.
- The element type is the type of property values
as defined by
Note: the rational for implementingIn addition, for each map entry the value returned byCheckedContainer
is to consider eachExtendedElementInformation
instance as the set of all possible values for the property. If the information had acontains(E)
method, it would returntrue
if the given value is valid for that property.ExtendedElementInformation.getDomainValue()
may optionally be an instance of any of the following classes:NumberRange
if the valid values are constrained to some specific range.
- Parameters:
type
- the metadata interface or implementation class.keyPolicy
- determines the string representation of map keys.- Returns:
- information about all properties defined in the given metadata type.
- Throws:
ClassCastException
- if the given type does not implement a metadata interface of the expected package.- See Also:
-
asIndexMap
public Map<String,Integer> asIndexMap(Class<?> type, KeyNamePolicy keyPolicy) throws ClassCastException Returns indices for all properties defined in the given metadata type. The keys in the returned map are the same than the keys in the above name map. The values are arbitrary indices numbered from 0 inclusive to n exclusive, where n is the number of properties declared in the given metadata type.Property indices may be used as an alternative to property names by some applications doing their own storage. Such index usages are fine for temporary storage during the Java Virtual Machine lifetime, but indices should not be used in permanent storage. The indices are stable as long as the metadata implementation does not change, but may change when the implementation is upgraded to a newer version.
- Parameters:
type
- the interface or implementation class of a metadata.keyPolicy
- determines the string representation of map keys.- Returns:
- indices of all properties defined by the given metadata type.
- Throws:
ClassCastException
- if the specified interface or implementation class does not extend or implement a metadata interface of the expected package.
-
asValueMap
public Map<String,Object> asValueMap(Object metadata, Class<?> baseType, KeyNamePolicy keyPolicy, ValueExistencePolicy valuePolicy) throws ClassCastException Returns a view of the specified metadata object as aMap
. The map is backed by the metadata object using Java reflection, so changes in the underlying metadata object are immediately reflected in the map and conversely.The map content is determined by the arguments:
metadata
determines the set of keys,keyPolicy
determines theirString
representations of those keys andvaluePolicy
determines whether entries having a null value or an empty collection shall be included in the map.Supported operations
The map supports theput(…)
andremove(…)
operations if the underlying metadata object contains setter methods. Theremove(…)
method is implemented by a call toput(…, null)
. Note that whether the entry appears as effectively removed from the map or just cleared (i.e. associated to a null value) depends on thevaluePolicy
argument.Keys and values
The keys are case-insensitive and can be either the JavaBeans property name, the getter method name or the UML identifier. The value given to a call to theput(…)
method shall be an instance of the type expected by the corresponding setter method, or an instance of a type convertible to the expected type.Multi-values entries
Calls toput(…)
replace the previous value, with one noticeable exception: if the metadata property associated to the given key is aCollection
but the given value is a single element (not a collection), then the given value is added to the existing collection. In other words, the returned map behaves as a multi-values map for the properties that allow multiple values. If the intent is to unconditionally discard all previous values, then make sure that the given value is a collection when the associated metadata property expects such collection.Disambiguating instances that implement more than one metadata interface
It is some time convenient to implement more than one interface by the same class. For example, an implementation interested only in extents defined by geographic bounding boxes could implementExtent
andGeographicBoundingBox
by the same class. In such case, it is necessary to tell to this method which one of those two interfaces shall be reflected in the returned map. This information can be provided by thebaseType
argument. That argument needs to be non-null only in situations where an ambiguity can arise;baseType
can be null if the given metadata implements only one interface recognized by thisMetadataStandard
instance.- Parameters:
metadata
- the metadata object to view as a map.baseType
- base type of the metadata of interest, ornull
if unspecified.keyPolicy
- determines the string representation of map keys.valuePolicy
- whether the entries having null value or empty collection shall be included in the map.- Returns:
- a map view over the metadata object.
- Throws:
ClassCastException
- if the metadata object does not implement a metadata interface of the expected package.- Since:
- 0.8
- See Also:
-
asTreeTable
public TreeTable asTreeTable(Object metadata, Class<?> baseType, ValueExistencePolicy valuePolicy) throws ClassCastException Returns the specified metadata object as a tree table. The tree table is backed by the metadata object using Java reflection, so changes in the underlying metadata object are immediately reflected in the tree table and conversely.The returned
TreeTable
instance contains the following columns:TableColumn.IDENTIFIER
The UML identifier if any, or the Java Beans property name otherwise, of a metadata property. For example in a tree table view ofDefaultCitation
, there is a node having the"title"
identifier.TableColumn.INDEX
If the metadata property is a collection, then the zero-based index of the element in that collection. Otherwisenull
. For example, in a tree table view ofDefaultCitation
, if the"alternateTitle"
collection contains two elements, then there is a node with index 0 for the first element and another node with index 1 for the second element.Note: The(IDENTIFIER, INDEX)
pair can be used as a primary key for uniquely identifying a node in a list of children. That uniqueness is guaranteed only for the children of a given node; the same keys may appear in the children of any other nodes.TableColumn.NAME
A human-readable name for the node, derived from the identifier and the index. This is the column shown in the defaulttoString()
implementation and may be localizable.TableColumn.TYPE
The base type of the value (usually an interface).TableColumn.VALUE
The metadata value for the node. Values in this column are writable if the underlying metadata class have a setter method for the property represented by the node.TableColumn.REMARKS
Remarks or warning on the property value. This is rarely present. It is provided when the value may look surprising, for example the longitude values in a geographic bounding box crossing the anti-meridian.
Write operations
Only theVALUE
column may be writable, with one exception: newly created children need to have theirIDENTIFIER
set before any other operation. For example, the following code adds a title to a citation: Nodes can be removed by invoking theIterator.remove()
method on the children iterator. Note that whether the child appears as effectively removed from the node or just cleared (i.e. associated to a null value) depends on thevaluePolicy
argument.Disambiguating instances that implement more than one metadata interface
If the givenmetadata
instance implements more than one interface recognized by thisMetadataStandard
, then thebaseType
argument need to be non-null in order to specify which interface to reflect in the tree.- Parameters:
metadata
- the metadata object to view as a tree table.baseType
- base type of the metadata of interest, ornull
if unspecified.valuePolicy
- whether the property having null value or empty collection shall be included in the tree.- Returns:
- a tree table representation of the specified metadata.
- Throws:
ClassCastException
- if the metadata object does not implement a metadata interface of the expected package.- Since:
- 0.8
- See Also:
-
equals
public boolean equals(Object metadata1, Object metadata2, ComparisonMode mode) throws ClassCastException Compares the two specified metadata objects. The two metadata arguments shall be implementations of a metadata interface defined by thisMetadataStandard
, otherwise an exception will be thrown. However, the two arguments do not need to be the same implementation class.Shallow or deep comparisons
This method implements a shallow comparison in that properties are compared by invoking theirproperties.equals(…)
method without explicit recursive call to thisstandard.equals(…)
method for children metadata. However, the comparison will do implicit recursive calls if theproperties.equals(…)
implementations delegate their work to thisstandard.equals(…)
method, asAbstractMetadata
does. In the latter case, the final result is a deep comparison.- Parameters:
metadata1
- the first metadata object to compare.metadata2
- the second metadata object to compare.mode
- the strictness level of the comparison.- Returns:
true
if the given metadata objects are equals.- Throws:
ClassCastException
- if at least one metadata object does not implement a metadata interface of the expected package.- See Also:
-
hashCode
Computes a hash code for the specified metadata. The hash code is defined as the sum of hash code values of all non-empty properties, plus the hash code of the interface. This is a similar contract thanSet.hashCode()
(except for the interface) and ensures that the hash code value is insensitive to the ordering of properties.- Parameters:
metadata
- the metadata object to compute hash code.- Returns:
- a hash code value for the specified metadata, or 0 if the given metadata is null.
- Throws:
ClassCastException
- if the metadata object does not implement a metadata interface of the expected package.- See Also:
-
toString
Returns a string representation of this metadata standard. This is for debugging purpose only and may change in any future version. -
setMapForField
static <T extends MetadataStandard> void setMapForField(Class<T> classe, T instance, String name) throws InvalidClassException Assigns aConcurrentMap
instance to the given field. Used on deserialization only.- Throws:
InvalidClassException
-
readObject
Invoked during deserialization for restoring the transient fields.- Parameters:
in
- the input stream from which to deserialize a metadata standard.- Throws:
IOException
- if an I/O error occurred while reading or if the stream contains invalid data.ClassNotFoundException
- if the class serialized on the stream is not on the classpath.
-