|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectObjectLinker
public class ObjectLinker
Invoked by the unmarshaller when xlink or uuidref attributes are found instead
of object definition. This class provides methods for assigning a UUID to an
arbitrary object, or fetching an existing object from a UUID.
Subclasses can override the methods defined in this class in order to search in their
own catalog. See the XML.LINKER javadoc for an example of registering a custom
ObjectLinker to a unmarshaller.
| utility/geotk-xml-base (download) | View source code for this class |
| Field Summary | |
|---|---|
static ObjectLinker |
DEFAULT
The default and thread-safe instance. |
| Constructor Summary | |
|---|---|
protected |
ObjectLinker()
Creates a default ObjectLinker. |
| Method Summary | ||
|---|---|---|
|
canUseReference(Class<T> type,
T object,
UUID uuid)
Returns true if the marshaller can use a reference to the given metadata
instead than writing the full element. |
|
|
newIdentifiedObject(Class<T> type,
Identifier... identifiers)
Returns an empty object of the given type having the given identifiers. |
|
|
resolve(Class<T> type,
NilReason nilReason)
Returns an object of the given type for the given nilReason attributes. |
|
|
resolve(Class<T> type,
UUID uuid)
Returns an object of the given type for the given uuid attribute, or null
if none. |
|
|
resolve(Class<T> type,
XLink link)
Returns an object of the given type for the given xlink attribute, or null
if none. |
|
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ObjectLinker DEFAULT
ObjectLinker was explicitly set by the XML.LINKER property.
| Constructor Detail |
|---|
protected ObjectLinker()
ObjectLinker. This constructor is for subclasses only.
| Method Detail |
|---|
public <T> T newIdentifiedObject(Class<T> type,
Identifier... identifiers)
type interface.IdentifiedObject interface.IdentifiedObject.getIdentifiers() will return the given identifiers.IdentifiedObject.getIdentifierMap() will return a Map
view over the given identifiers.Object class will return
null or an empty collection.
T - The compile-time type of the type argument.type - The type of object to be unmarshalled as an interface.
This is usually a GeoAPI interface.identifiers - An arbitrary amount of identifiers. For each identifier, the
authority is typically (but not
necessarily) one of the constants defined in IdentifierSpace.
null if none.
public <T> T resolve(Class<T> type,
UUID uuid)
uuid attribute, or null
if none. The default implementation first looks in an internal map for previously unmarshalled
object having the given UUID.
T - The compile-time type of the type argument.type - The type of object to be unmarshalled as an interface.
This is usually a GeoAPI interface.uuid - The uuid attributes.
uuid attribute,
or null if none.
public <T> T resolve(Class<T> type,
XLink link)
xlink attribute, or null
if none. The default implementation returns null in all cases.
T - The compile-time type of the type argument.type - The type of object to be unmarshalled as an interface.
This is usually a GeoAPI interface.link - The xlink attributes.
xlink attribute,
or null if none.
public <T> T resolve(Class<T> type,
NilReason nilReason)
nilReason attributes. The default
implementation returns an immutable object which implement the NilObject interface
and the given type. The NilObject.getNilReason() method will return the
given reason, and all other methods (except the ones inherited from the Object
class) will return null or an empty collection as appropriate.
T - The compile-time type of the type argument.type - The type of object to be unmarshalled as an interface.
This is usually a GeoAPI interface.nilReason - The nilReason attribute.
nilReason attribute,
or null if none.
public <T> boolean canUseReference(Class<T> type,
T object,
UUID uuid)
true if the marshaller can use a reference to the given metadata
instead than writing the full element. This method is invoked when a metadata to
be marshalled has a UUID identifier. Because those metadata may be defined externally,
Geotk can not know if the metadata shall be fully marshalled or not. This information
must be provided by the application.
The default implementation conservatively returns false in every cases.
T - The compile-time type of the type argument.type - The type of object to be marshalled as an interface.
This is usually a GeoAPI interface.object - The object to be marshalled.uuid - The unique identifier of the object to be marshalled.
true if the marshaller can use the uuidref attribute
instead than marshalling the given metadata.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||