|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.openharbor.beck.id.SerialNumber
Assigns serial numbers to objects, regardless of their content or ancestry. Uses an 'sn' attribute as an ID, and an 'snref' attribute as an IDREF. This is sufficient to pack an object graph into a simple XML tree. But the serial numbers are useful only within the scope of a single XML document; they're not useful for inter-document references or correlating multiple XML documents that contain copies of an object.
Field Summary | |
protected XMLName |
idName
|
protected XMLName |
idRefName
|
protected org.apache.commons.logging.Log |
log
|
Fields inherited from interface com.openharbor.beck.id.Identifier |
IDREF_TO_DANGLING_REFERENCES, IDREF_TO_REFERENT |
Constructor Summary | |
SerialNumber()
|
Method Summary | |
XMLThing |
getIdReference(java.lang.Object parent,
Getter getter,
java.lang.Object source,
XMLThing referent,
XMLWriter writer)
Construct an XML reference to the given XML element or attribute. |
XMLThing |
getIdReferent(java.lang.Object parent,
Getter getter,
java.lang.Object source,
XMLThing referent,
XMLWriter writer)
Add anchor data to the XML element or attribute for a given Java object. |
XMLThing |
getReferenceKey(Unmarshaller reference)
Extract the essential data of the given XML reference to an XML element or attribute. |
XMLThing |
getReferentKey(Unmarshaller referent)
Extract the essential data of a given XML element or attribute. |
java.lang.Class |
getUnmarshallerClass(MapFromXML mapper,
Unmarshaller parent,
XMLThing source,
XMLContext context)
If the given source is a cross-reference, return the class of Unmarshaller for it. |
protected java.lang.String |
newId(java.lang.Object parent,
Getter getter,
java.lang.Object source,
XMLThing referent,
XMLWriter writer)
|
static void |
setGenerator(long n)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final org.apache.commons.logging.Log log
protected XMLName idName
protected XMLName idRefName
Constructor Detail |
public SerialNumber()
Method Detail |
public static void setGenerator(long n)
protected java.lang.String newId(java.lang.Object parent, Getter getter, java.lang.Object source, XMLThing referent, XMLWriter writer)
public XMLThing getIdReferent(java.lang.Object parent, Getter getter, java.lang.Object source, XMLThing referent, XMLWriter writer)
Identifier
If the returned thing is an element with a null value, the caller should output the element and also additional attributes and/or content mapped from the source object. If the returned thing is an attribute or an element with a non-null value, the caller should output the returned thing without additions.
The implementation can and should simply return the given referent, if it can't be referred to or already contains the necessary anchor data. The parameters provide enough context to enable sophisticated algorithms, but many implementations won't need them.
getIdReferent
in interface Identifier
parent
- the object that contains source, or null if source is the root objectgetter
- the relationship from parent to sourcesource
- the Java object to be marshalledreferent
- the caller's choice of XML (from a MapToXML, usually)writer
- whither this object will be marshalled
public XMLThing getIdReference(java.lang.Object parent, Getter getter, java.lang.Object source, XMLThing referent, XMLWriter writer)
Identifier
getIdReference
in interface Identifier
public XMLThing getReferenceKey(Unmarshaller reference)
Identifier
getReferenceKey
in interface Identifier
public XMLThing getReferentKey(Unmarshaller referent)
Identifier
getReferentKey
in interface Identifier
public java.lang.Class getUnmarshallerClass(MapFromXML mapper, Unmarshaller parent, XMLThing source, XMLContext context)
Identifier
getUnmarshallerClass
in interface Identifier
mapper
- parent
- source
- context
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |