| java.lang.Object org.jibx.binding.def.StringConversion org.jibx.binding.def.ObjectStringConversion
ObjectStringConversion | public class ObjectStringConversion extends StringConversion (Code) | | Object string conversion handling. Defines serialization handling for
converting objects to and from a 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.
author: Dennis M. Sosnoski version: 1.0 |
ObjectStringConversion | ObjectStringConversion(String type, ObjectStringConversion inherit) throws JiBXException(Code) | | Constructor. Initializes conversion handling based on the supplied
inherited handling.
Parameters: type - fully qualified name of class handled by conversion Parameters: inherit - conversion information inherited by this conversion throws: JiBXException - if error in configuration |
ObjectStringConversion | ObjectStringConversion(Object dflt, String ser, String deser, String type)(Code) | | Constructor. Initializes conversion handling based on argument values.
This form is only used for constructing the default set of conversions.
Because of this, it throws an unchecked exception on error.
Parameters: dflt - default value object (wrapped value for primitive types,otherwise String ) Parameters: ser - fully qualified name of serialization method Parameters: deser - fully qualified name of deserialization method Parameters: type - fully qualified name of class handled by conversion |
convertDefault | protected Object convertDefault(String text) throws JiBXException(Code) | | Convert text representation into default value object. For object types
this just returns the text value.
Parameters: text - value representation to be converted converted default value object throws: JiBXException - on conversion error |
derive | public StringConversion derive(String type, String ser, String dser, String dflt) throws JiBXException(Code) | | Derive from existing formatting information. This allows constructing
a new instance from an existing format of the same or an ancestor
type, with the properties of the existing format copied to the new
instance except where overridden by the supplied values.
Parameters: type - fully qualified name of class handled by conversion Parameters: ser - fully qualified name of serialization method(null if inherited) Parameters: dser - fully qualified name of deserialization method(null if inherited) Parameters: dflt - default value text (null if inherited) new instance initialized from existing one throws: JiBXException - if error in configuration information |
genFromText | public void genFromText(ContextMethodBuilder mb) throws JiBXException(Code) | | Generate code to convert 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.
Parameters: mb - method builder |
genParseOptional | public void genParseOptional(boolean attr, ContextMethodBuilder mb) throws JiBXException(Code) | | Generate code to parse and convert optional attribute or element. The
code generated by this method assumes that the unmarshalling context
and name information for the attribute or element have already
been pushed on the stack. It consumes these and leaves the converted
value (or converted default value, if the item itself is missing) on
the stack.
Parameters: attr - item is an attribute (vs element) flag Parameters: mb - method builder throws: JiBXException - if error in configuration |
genParseRequired | public void genParseRequired(boolean attr, ContextMethodBuilder mb) throws JiBXException(Code) | | Generate code to parse and convert required attribute or element. The
code generated by this method assumes that the unmarshalling context and
name information for the attribute or element have already been pushed
on the stack. It consumes these and leaves the converted value on the
stack.
Parameters: attr - item is an attribute (vs element) flag Parameters: mb - method builder throws: JiBXException - if error in configuration |
genToOptionalText | protected BranchWrapper genToOptionalText(String type, ContextMethodBuilder mb, int extra) throws JiBXException(Code) | | Generate code to check if an optional value is not equal to the default.
The code generated by this method assumes that the actual value to be
converted has already been pushed on the stack. It consumes this,
leaving the converted text reference on the stack if it's not equal to
the default value.
Parameters: type - fully qualified class name for value on stack Parameters: mb - method builder Parameters: extra - count of extra values to be popped from stack if missing handle for branch taken when value is equal to the default(target must be set by caller) throws: JiBXException - if error in configuration |
genToText | public void genToText(String type, ContextMethodBuilder mb) throws JiBXException(Code) | | Shared code generation for converting instance of type to
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.
Parameters: type - fully qualified class name for value on stack Parameters: mb - marshal method builder throws: JiBXException - if error in configuration |
isPrimitive | public boolean isPrimitive()(Code) | | Check if the type handled by this conversion is of a primitive type.
false to indicate object type |
Methods inherited from org.jibx.binding.def.StringConversion | abstract protected Object convertDefault(String text) throws JiBXException(Code)(Java Doc) abstract public StringConversion derive(String type, String ser, String dser, String dflt) throws JiBXException(Code)(Java Doc) abstract public void genFromText(ContextMethodBuilder mb) throws JiBXException(Code)(Java Doc) abstract public void genParseOptional(boolean attr, ContextMethodBuilder mb) throws JiBXException(Code)(Java Doc) abstract public void genParseRequired(boolean attr, ContextMethodBuilder mb) throws JiBXException(Code)(Java Doc) public void genPopValues(int count, ContextMethodBuilder mb)(Code)(Java Doc) abstract protected BranchWrapper genToOptionalText(String type, ContextMethodBuilder mb, int extra) throws JiBXException(Code)(Java Doc) public void genToText(String type, ContextMethodBuilder mb) throws JiBXException(Code)(Java Doc) public void genWriteOptional(boolean attr, String type, ContextMethodBuilder mb) throws JiBXException(Code)(Java Doc) public void genWriteRequired(boolean attr, String type, ContextMethodBuilder mb) throws JiBXException(Code)(Java Doc) public void genWriteText(boolean attr, ContextMethodBuilder mb)(Code)(Java Doc) public String getTypeName()(Code)(Java Doc) abstract public boolean isPrimitive()(Code)(Java Doc) protected void setDeserializer(String deser) throws JiBXException(Code)(Java Doc) protected void setSerializer(String ser) throws JiBXException(Code)(Java Doc)
|
|
|