| java.lang.Object org.jibx.binding.def.StringConversion org.jibx.binding.def.PrimitiveStringConversion
PrimitiveStringConversion | public class PrimitiveStringConversion extends StringConversion (Code) | | Primitive string conversion handling. Class for handling serialization
converting a primitive type to and from String values.
author: Dennis M. Sosnoski version: 1.0 |
PrimitiveStringConversion | protected PrimitiveStringConversion(String type, PrimitiveStringConversion inherit)(Code) | | Constructor. Initializes conversion handling based on the supplied
inherited handling.
Parameters: type - name of primitive type handled by conversion Parameters: inherit - conversion information inherited by this conversion |
PrimitiveStringConversion | public PrimitiveStringConversion(Class cls, Object dflt, String code, String ts, String fs, String uattr, String uelem)(Code) | | Constructor. Initializes conversion handling based on argument values.
This form is only used for constructing the default set of conversions.
Parameters: cls - class of primitive type handled by conversion Parameters: dflt - default value object (wrapped value, or String or null with special deserializer) Parameters: ts - name of utility class static method for converting value to String Parameters: fs - name of utility class static method for convertingString to value Parameters: uattr - unmarshalling context method name for attribute value Parameters: uelem - unmarshalling context method name for element value |
convertDefault | protected Object convertDefault(String text) throws JiBXException(Code) | | Convert text representation into default value object. This override of
the base class method uses reflection to call the actual deserialization
method, returning the wrapped result value. If a custom deserializer is
defined this just returns the String value directly.
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)(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 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 |
isPrimitive | public boolean isPrimitive()(Code) | | Check if the type handled by this conversion is of a primitive type.
true to indicate primitive type |
pushDefault | protected void pushDefault(ContextMethodBuilder mb)(Code) | | Push default value on stack. Just adds the appropriate instruction to
the list for the method.
Parameters: mb - method builder |
setDeserializer | protected void setDeserializer(String deser) throws JiBXException(Code) | | Set deserializer for conversion. This override of the base class method
sets a flag to indicate that values must be read from a document as text
and converted as a separate step after executing the base class
processing.
Parameters: deser - fully qualified class and method name of deserializer throws: JiBXException - if deserializer not found or not usable |
setSerializer | protected void setSerializer(String ser) throws JiBXException(Code) | | Set serializer for conversion. This override of the base class method
sets a flag to indicate that values must be converted to text before
they are written to a document after executing the base class processing.
Parameters: ser - fully qualified class and method name of serializer throws: JiBXException - if serializer not found or not usable |
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)
|
|
|