Package jade.content.lang.xml
Class XMLCodec
- java.lang.Object
-
- jade.content.lang.Codec
-
- jade.content.lang.StringCodec
-
- jade.content.lang.xml.XMLCodec
-
- All Implemented Interfaces:
Serializable,Serializable
public class XMLCodec extends StringCodec
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jade.content.lang.Codec
Codec.CodecException
-
-
Field Summary
Fields Modifier and Type Field Description static StringAGGREGATE_ATTRstatic StringAGGREGATE_TYPE_ATTRstatic StringBINARY_STARTERstatic StringNAMEstatic StringPRIMITIVE_TAGstatic StringTYPE_ATTRstatic StringVALUE_ATTR-
Fields inherited from class jade.content.lang.Codec
UNNAMEDPREFIX
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbsContentElementdecode(Ontology ontology, String content).AbsContentElementdecode(String content)Decodes the content to an abstract description.AbsObjectdecodeAbsObject(Ontology ontology, String xml)ObjectdecodeObject(Ontology ontology, String xml)Decode a generic ontological entity from an XML formStringencode(AbsContentElement content)Encodes a content into a string.Stringencode(Ontology ontology, AbsContentElement content)Encodes a content into a string using a given ontology.StringencodeAbsObject(Ontology ontology, AbsObject abs, boolean indent)StringencodeObject(Ontology ontology, Object obj, boolean indent)Encode a generic ontological entity in XML form-
Methods inherited from class jade.content.lang.Codec
getInnerOntology, getName
-
-
-
-
Field Detail
-
NAME
public static final String NAME
- See Also:
- Constant Field Values
-
PRIMITIVE_TAG
public static final String PRIMITIVE_TAG
- See Also:
- Constant Field Values
-
VALUE_ATTR
public static final String VALUE_ATTR
- See Also:
- Constant Field Values
-
TYPE_ATTR
public static final String TYPE_ATTR
- See Also:
- Constant Field Values
-
AGGREGATE_ATTR
public static final String AGGREGATE_ATTR
- See Also:
- Constant Field Values
-
AGGREGATE_TYPE_ATTR
public static final String AGGREGATE_TYPE_ATTR
- See Also:
- Constant Field Values
-
BINARY_STARTER
public static final String BINARY_STARTER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XMLCodec
public XMLCodec()
Create an XMLCodec that preserves java primitive types (long, int, float, double). This is achieved by encoding long values asL and float values as XMLCodec(null)
-
XMLCodec
public XMLCodec(boolean preserveJavaTypes)
Create an XMLCodec specifying whether or not java primitive types (long, int, float, double) must be preserved.
-
-
Method Detail
-
encode
public String encode(AbsContentElement content) throws Codec.CodecException
Encodes a content into a string.- Specified by:
encodein classStringCodec- Parameters:
content- the content as an abstract descriptor.- Returns:
- the content as a string.
- Throws:
Codec.CodecException
-
encode
public String encode(Ontology ontology, AbsContentElement content) throws Codec.CodecException
Encodes a content into a string using a given ontology.- Specified by:
encodein classStringCodec- Parameters:
ontology- the ontologycontent- the content as an abstract descriptor.- Returns:
- the content as a string.
- Throws:
Codec.CodecException
-
encodeAbsObject
public String encodeAbsObject(Ontology ontology, AbsObject abs, boolean indent) throws Codec.CodecException, OntologyException
-
encodeObject
public String encodeObject(Ontology ontology, Object obj, boolean indent) throws Codec.CodecException, OntologyException
Encode a generic ontological entity in XML form
-
decode
public AbsContentElement decode(String content) throws Codec.CodecException
Decodes the content to an abstract description.- Specified by:
decodein classStringCodec- Parameters:
content- the content as a string.- Returns:
- the content as an abstract description.
- Throws:
Codec.CodecException
-
decode
public AbsContentElement decode(Ontology ontology, String content) throws Codec.CodecException
. Decodes the content to an abstract description using a given ontology.- Specified by:
decodein classStringCodec- Parameters:
ontology- the ontology.content- the content as a string.- Returns:
- the content as an abstract description.
- Throws:
Codec.CodecException
-
decodeAbsObject
public AbsObject decodeAbsObject(Ontology ontology, String xml) throws Codec.CodecException, OntologyException
-
decodeObject
public Object decodeObject(Ontology ontology, String xml) throws Codec.CodecException, OntologyException
Decode a generic ontological entity from an XML form
-
-