|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dsto.dfc.databeans.io.XmlEncodeContext
public class XmlEncodeContext
Contains context state during an XML encoding operation. XmlEncoder clients
receive an instance via
XmlEncoder.encode(XmlEncodeContext, Object)
.
Nested Class Summary | |
---|---|
static interface |
XmlEncodeContext.IdCallback
Callback interface for clients that wish to use forward references. |
Constructor Summary | |
---|---|
protected |
XmlEncodeContext(List xmlEncoders,
List textEncoders,
Map typeAliases)
|
Method Summary | |
---|---|
void |
callbackWithIdForObject(XmlEncodeContext.IdCallback callback,
org.jdom.Element element,
Object value,
Object extraData)
Register a callback to be invoked when an ID becomes defined for another encoded value. |
protected void |
doPostEncode()
|
org.jdom.Element |
encode(Object value)
Mediates the encoding of a value. |
String |
encodeType(Class valueClass)
Get the encoded type name for a class, taking type aliases and array encoding into account. |
Object |
getProperty(Object name)
Get a custom property defined by setProperty(Object, Object) . |
TextEncoder |
getTextEncoder(Object value)
Get the registered text encoder for a given value. |
String |
getTypeAlias(Class valueClass)
Get the alias for a given type. |
XmlEncoder |
getXmlEncoder(Object value)
Get the registered XML encoder for a given value. |
TextEncoder |
peekTextEncoder(Object value)
Lookup the registered text encoder for a given value. |
void |
registerElement(org.jdom.Element element,
Object value)
Register a document element as representing a given value. |
protected void |
setProperties(Map properties)
Set all custom properties. |
void |
setProperty(Object name,
Object value)
Define a custom property that will be accessible during this session via getProperty(Object) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected XmlEncodeContext(List xmlEncoders, List textEncoders, Map typeAliases)
Method Detail |
---|
protected void doPostEncode()
protected void setProperties(Map properties)
XmlOutput
.
setProperty(Object, Object)
public void setProperty(Object name, Object value)
getProperty(Object)
.
XmlOutput.setProperty(Object, Object)
public Object getProperty(Object name)
setProperty(Object, Object)
.
public org.jdom.Element encode(Object value)
value
- The value to encode.
IllegalArgumentException
- if the value could not be encoded.public XmlEncoder getXmlEncoder(Object value)
public TextEncoder getTextEncoder(Object value) throws IllegalStateException
IllegalStateException
- if no encoder found.peekTextEncoder(Object)
public TextEncoder peekTextEncoder(Object value)
getTextEncoder(Object)
public String getTypeAlias(Class valueClass)
public String encodeType(Class valueClass)
XmlDecodeContext.decodeType(String)
public void registerElement(org.jdom.Element element, Object value)
Clients do not need to call this, since
encode(Object)
does this automatically, but may
choose to do so early if they contain child values that may
reference the value.
public void callbackWithIdForObject(XmlEncodeContext.IdCallback callback, org.jdom.Element element, Object value, Object extraData)
XmlEncodeContext.IdCallback.idForObjectCallback(dsto.dfc.databeans.io.XmlEncodeContext, org.jdom.Element, java.lang.String, java.lang.Object)
.
The callback will be invoked immediately if an ID is already
available.
callback
- The callback target.element
- The element param to be passed to the callback.value
- The value for which an ID is needed.extraData
- Any extra data to be passed to the callback (may
be null).XmlEncodeContext.IdCallback.idForObjectCallback(dsto.dfc.databeans.io.XmlEncodeContext, org.jdom.Element, java.lang.String, java.lang.Object)
,
XmlDecodeContext.callbackWithObjectForId(dsto.dfc.databeans.io.XmlDecodeContext.IdCallback, org.jdom.Element, java.lang.String, java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |