Class ObjectReference

java.lang.Object
org.apache.sis.internal.jaxb.gco.ObjectReference

final class ObjectReference extends Object
The gco:ObjectReference XML attribute group is included by all metadata wrappers defined in the org.apache.sis.internal.jaxb.metadata package. The attributes of interest defined in this group are uuidref, xlink:href, xlink:role, xlink:arcrole, xlink:title, xlink:show and xlink:actuate.

This gco:ObjectReference group is complementary to gco:ObjectIdentification, which define the id and uuid attributes to be supported by all metadata implementations in the public org.apache.sis.metadata.iso package and sub-packages.

Since:
0.3
Version:
0.3
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) UUID
    A unique identifier to an external resources, or to another part of a XML document.
    (package private) XLink
    The xlink attributes, or null if none.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an initially empty object reference.
    ObjectReference(UUID uuid, XLink link)
    Creates an object reference initialized to the given value.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static <T> void
    putInto(Context context, IdentifierMap map, IdentifierSpace<T> authority, T value)
    Adds a new identifier into the given map, if non null.
    (package private) final <T> T
    resolve(Context context, Class<T> type, T metadata)
    If the given metadata object is null, tries to get an instance from the identifiers declared in this ObjectReference.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • uuid

      UUID uuid
      A unique identifier to an external resources, or to another part of a XML document. The uuidref attribute is used to refer to an XML element that has a corresponding uuid attribute.
      See Also:
  • Constructor Details

  • Method Details

    • resolve

      final <T> T resolve(Context context, Class<T> type, T metadata)
      If the given metadata object is null, tries to get an instance from the identifiers declared in this ObjectReference. If the given metadata object is non-null, assigns to that object the identifiers declared in this ObjectReference.

      This method is invoked at unmarshalling time by PropertyType.resolve(Context).

      Type Parameters:
      T - the compile-time type of the type argument.
      Parameters:
      context - the marshalling context, or null if none.
      type - the expected type of the metadata object.
      metadata - the metadata object, or null.
      Returns:
      a metadata object for the identifiers, or null
    • putInto

      private static <T> void putInto(Context context, IdentifierMap map, IdentifierSpace<T> authority, T value)
      Adds a new identifier into the given map, if non null. No previous value should exist in normal situation. However, a previous value may exit in unusual (probably not very valid) XML, as in the following example: In such situation, this method is silent if the two identifiers are equal, or logs a warning and restores the previous value if they are not equal. The previous value is the "uuid" attribute, which is assumed more closely tied to the actual metadata than the uuidref attribute.
      Parameters:
      map - the map in which to write the identifier.
      authority - the identifier authority.
      value - the identifier value, or null if not yet defined.