public class ObjectStringConversion extends StringConversion
String value. The default is
to just use the object toString() method for serialization and
a constructor from a String value for deserialization.
java.lang.String itself is a special case, with no added code
used by default for either serializing or deserializing.
java.lang.Object is also a special case, with no added code
used by default for deserializing (the String value is used
directly). Other classes must either implement toString() and
a constructor from String, or use custom serializers and/or
deserializers.COMPARE_OBJECTS_METHOD, COMPARE_OBJECTS_SIGNATURE, DESERIALIZER_SIGNATURES, m_converter, m_default, m_deserializer, m_serializer, m_typeName, m_typeSignature, MARSHAL_ATTRIBUTE, MARSHAL_ELEMENT, MARSHAL_NAME_VALUES, MARSHAL_SIGNATURE, UNMARSHAL_OPT_ATTRIBUTE, UNMARSHAL_OPT_ELEMENT, UNMARSHAL_OPT_SIGNATURE, UNMARSHAL_REQ_ATTRIBUTE, UNMARSHAL_REQ_ELEMENT, UNMARSHAL_REQ_SIGNATURE, WHITESPACE_CONVERT_SIGNATURES| Modifier and Type | Method and Description |
|---|---|
protected Object |
convertDefault(String text)
Convert text representation into default value object.
|
StringConversion |
derive(String type,
String ser,
String conv,
String dser,
String dflt)
Derive from existing formatting information.
|
void |
genFromText(ContextMethodBuilder mb)
Generate code to convert
String representation. |
void |
genParseOptional(boolean attr,
ContextMethodBuilder mb)
Generate code to parse and convert optional attribute or element.
|
void |
genParseRequired(boolean attr,
ContextMethodBuilder mb)
Generate code to parse and convert required attribute or element.
|
protected BranchWrapper |
genToOptionalText(String type,
ContextMethodBuilder mb,
int extra)
Generate code to check if an optional value is not equal to the default.
|
void |
genToText(String type,
ContextMethodBuilder mb)
Shared code generation for converting instance of type to
String. |
boolean |
isPrimitive()
Check if the type handled by this conversion is of a primitive type.
|
genPopValues, genWriteOptional, genWriteRequired, genWriteText, getTypeName, setDeserializer, setSerializer, setWhitespaceConverterpublic void genFromText(ContextMethodBuilder mb) throws org.jibx.runtime.JiBXException
String representation. The
code generated by this method assumes that the String
value has already been pushed on the stack. It consumes this and
leaves the converted value on the stack.genFromText in class StringConversionmb - method builderorg.jibx.runtime.JiBXException - Error if no de-serializerpublic void genParseOptional(boolean attr,
ContextMethodBuilder mb)
throws org.jibx.runtime.JiBXException
genParseOptional in class StringConversionattr - item is an attribute (vs element) flagmb - method builderorg.jibx.runtime.JiBXException - if error in configurationpublic void genParseRequired(boolean attr,
ContextMethodBuilder mb)
throws org.jibx.runtime.JiBXException
genParseRequired in class StringConversionattr - item is an attribute (vs element) flagmb - method builderorg.jibx.runtime.JiBXException - if error in configurationpublic void genToText(String type, ContextMethodBuilder mb) throws org.jibx.runtime.JiBXException
String. This override of the base class method checks for
serialization using the toString method and implements that
case directly, while calling the base class method for normal handling.
The code generated by this method assumes that the reference to the
instance to be converted is on the stack. It consumes the reference,
replacing it with the corresponding String value.genToText in class StringConversiontype - fully qualified class name for value on stackmb - marshal method builderorg.jibx.runtime.JiBXException - if error in configurationprotected BranchWrapper genToOptionalText(String type, ContextMethodBuilder mb, int extra) throws org.jibx.runtime.JiBXException
genToOptionalText in class StringConversiontype - fully qualified class name for value on stackmb - method builderextra - count of extra values to be popped from stack if missingorg.jibx.runtime.JiBXException - if error in configurationpublic boolean isPrimitive()
isPrimitive in class StringConversionfalse to indicate object typeprotected Object convertDefault(String text) throws org.jibx.runtime.JiBXException
convertDefault in class StringConversiontext - value representation to be convertedorg.jibx.runtime.JiBXException - on conversion errorpublic StringConversion derive(String type, String ser, String conv, String dser, String dflt) throws org.jibx.runtime.JiBXException
derive in class StringConversiontype - fully qualified name of class handled by conversion
(null if inherited)ser - fully qualified name of serialization method
(null if inherited)conv - fully qualified name of whitespace conversion method
(null if inherited)dser - fully qualified name of deserialization method
(null if inherited)dflt - default value text (null if inherited)org.jibx.runtime.JiBXException - if error in configuration informationCopyright © 2005–2016 jibx.org. All rights reserved.