Top Description Fields Constructors Methods
org.glassfish.jaxb.runtime.v2.runtime.unmarshaller

pack-priv final Class DefaultIDResolver

extends IDResolver
Class Inheritance
Imports
org.glassfish.jaxb.runtime.IDResolver, jakarta.xml.bind.ValidationEventHandler, org.xml.sax.SAXException, java.util.HashMap, java.util.concurrent.Callable

Default implementation of IDResolver.
Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
private HashMap<String, Object>
idmap

Records ID->Object map.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
bind(String id, Object obj)

Implements abstract org.glassfish.jaxb.runtime.IDResolver.bind.

Binds the given object to the specified ID.

While a document is being unmarshalled, every time an ID value is found, this method is invoked to remember the association between ID and objects.

public Callable<V>
resolve(final String id, Class<T> targetType)

Implements abstract org.glassfish.jaxb.runtime.IDResolver.resolve.

Obtains the object to be pointed by the IDREF value.

public void
startDocument(ValidationEventHandler eventHandler)

Overrides org.glassfish.jaxb.runtime.IDResolver.startDocument.

Called when the unmarshalling starts.

Inherited from org.glassfish.jaxb.runtime.IDResolver:
endDocument

Field Detail

idmapback to summary
private HashMap<String, Object> idmap

Records ID->Object map.

Constructor Detail

DefaultIDResolverback to summary
pack-priv DefaultIDResolver()

Method Detail

bindback to summary
public void bind(String id, Object obj)

Implements abstract org.glassfish.jaxb.runtime.IDResolver.bind.

Doc from org.glassfish.jaxb.runtime.IDResolver.bind.

Binds the given object to the specified ID.

While a document is being unmarshalled, every time an ID value is found, this method is invoked to remember the association between ID and objects. This association is supposed to be used later to resolve IDREFs.

This method is invoked right away as soon as a new ID value is found.

Annotations
@Override
resolveback to summary
public Callable<V> resolve(final String id, Class<T> targetType)

Implements abstract org.glassfish.jaxb.runtime.IDResolver.resolve.

Doc from org.glassfish.jaxb.runtime.IDResolver.resolve.

Obtains the object to be pointed by the IDREF value.

While a document is being unmarshalled, every time an IDREF value is found, this method is invoked immediately to obtain the object that the IDREF is pointing to.

This method returns a Callable to support forward-references. When this method returns with a non-null return value, the JAXB RI unmarshaller invokes the Callable#call() method immediately. If the implementation can find the target object (in which case it was a backward reference), then a non-null object shall be returned, and it is used as the target object.

When a forward-reference happens, the call method should return null. In this case the JAXB RI unmarshaller invokes the call method again after all the documents are fully unmarshalled. If the call method still returns null, then the JAXB RI unmarshaller treats it as an error.

A Callable object returned from this method may not throw any exception other than a SAXException (which means a fatal error.)

Annotations
@Override
startDocumentback to summary
public void startDocument(ValidationEventHandler eventHandler) throws SAXException

Overrides org.glassfish.jaxb.runtime.IDResolver.startDocument.

Doc from org.glassfish.jaxb.runtime.IDResolver.startDocument.

Called when the unmarshalling starts.

Since one Unmarshaller may be used multiple times to unmarshal documents, one may be used multiple times, too.

Annotations
@Override