|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdsto.dfc.databeans.io.XmlCollectionsCodec
public class XmlCollectionsCodec
Handles XML encode/decode of the Java collections types (Set, Map, List, or generic Collection). Also has special handling for IDataObject-compatible collections (eg SetDataObject, ListDataObject, etc).
Constructor Summary | |
---|---|
XmlCollectionsCodec()
|
Method Summary | |
---|---|
boolean |
canEncode(XmlEncodeContext context,
Object value)
Test if this codec can encode a given object. |
Object |
decode(XmlDecodeContext context,
org.jdom.Element element)
Decode an XML representation into a value. |
protected Object |
decodeCollection(XmlDecodeContext context,
org.jdom.Element element,
Class defaultType)
Decode a java.util.Collection. |
protected Object |
decodeMap(XmlDecodeContext context,
org.jdom.Element element)
|
org.jdom.Element |
encode(XmlEncodeContext context,
Object value)
Generate an XML representation of an object. |
protected org.jdom.Element |
encodeCollection(XmlEncodeContext context,
Collection collection)
Encode any java.util.Collection, with some extra special handling for List's. |
protected void |
encodeCollectionType(XmlEncodeContext context,
org.jdom.Element element,
Object collection,
Class defaultType)
Add the type and unmodifiable/synchronized attributes for a collection. |
protected org.jdom.Element |
encodeMap(XmlEncodeContext context,
Map map)
|
protected org.jdom.Element |
encodeSet(XmlEncodeContext context,
Set set)
|
boolean |
shouldPreserveIdentity(XmlEncodeContext context,
Object value)
Return true if the identity of the given value should be preserved. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlCollectionsCodec()
Method Detail |
---|
public boolean shouldPreserveIdentity(XmlEncodeContext context, Object value)
XmlEncoder
shouldPreserveIdentity
in interface XmlEncoder
public boolean canEncode(XmlEncodeContext context, Object value)
XmlEncoder
canEncode
in interface XmlEncoder
context
- The current encode context.value
- The value. May be null.
public org.jdom.Element encode(XmlEncodeContext context, Object value)
XmlEncoder
encode
in interface XmlEncoder
context
- The encoding context.value
- The value to be encoded.
public Object decode(XmlDecodeContext context, org.jdom.Element element) throws IllegalArgumentException, ClassNotFoundException
XmlDecoder
decode
in interface XmlDecoder
context
- The decode context.element
- The element to decode.
IllegalArgumentException
- if an error is found in the structure
of the document.
ClassNotFoundException
- if a referenced class cannot be found.protected org.jdom.Element encodeMap(XmlEncodeContext context, Map map)
protected org.jdom.Element encodeSet(XmlEncodeContext context, Set set)
protected org.jdom.Element encodeCollection(XmlEncodeContext context, Collection collection)
protected void encodeCollectionType(XmlEncodeContext context, org.jdom.Element element, Object collection, Class defaultType)
context
- The context.element
- The element to build on.collection
- The collection.defaultType
- The default non-IDataObject type for the
collection. If the collection is not an IDataObject and
this is the same as the collection's actual type, the
type attribute will be omitted.protected Object decodeMap(XmlDecodeContext context, org.jdom.Element element) throws ClassNotFoundException, IllegalArgumentException
ClassNotFoundException
IllegalArgumentException
protected Object decodeCollection(XmlDecodeContext context, org.jdom.Element element, Class defaultType) throws ClassNotFoundException, IllegalArgumentException
ClassNotFoundException
IllegalArgumentException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |