|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jibx.binding.def.StringConversion
public abstract class StringConversion
String conversion handling. Defines serialization handling for converting
to and from a String value. This uses an inheritance approach,
where each serialization definition is initialized based on the handling
set for the containing definition of the same (or parent class) type.
| Field Summary | |
|---|---|
protected static String |
COMPARE_OBJECTS_METHOD
|
protected static String |
COMPARE_OBJECTS_SIGNATURE
|
protected static String[] |
DESERIALIZER_SIGNATURES
|
protected ClassItem |
m_converter
Whitespace conversion method information. |
protected Object |
m_default
Default value used for this type (wrapper for primitives, otherwise String or null). |
protected ClassItem |
m_deserializer
Deserializer method information. |
protected ClassItem |
m_serializer
Serializer method information. |
protected String |
m_typeName
Fully qualified name of class handled by conversion. |
protected String |
m_typeSignature
Signature of class handled by conversion. |
protected static String |
MARSHAL_ATTRIBUTE
|
protected static String |
MARSHAL_ELEMENT
|
static int |
MARSHAL_NAME_VALUES
|
protected static String |
MARSHAL_SIGNATURE
|
protected static String |
UNMARSHAL_OPT_ATTRIBUTE
|
protected static String |
UNMARSHAL_OPT_ELEMENT
|
protected static String |
UNMARSHAL_OPT_SIGNATURE
|
protected static String |
UNMARSHAL_REQ_ATTRIBUTE
|
protected static String |
UNMARSHAL_REQ_ELEMENT
|
protected static String |
UNMARSHAL_REQ_SIGNATURE
|
protected static String[] |
WHITESPACE_CONVERT_SIGNATURES
|
| Constructor Summary | |
|---|---|
protected |
StringConversion(String type,
StringConversion inherit)
Constructor. |
| Method Summary | |
|---|---|
protected abstract Object |
convertDefault(String text)
Convert text representation into default value object. |
abstract StringConversion |
derive(String type,
String ser,
String conv,
String dser,
String dflt)
Derive from existing formatting information. |
abstract void |
genFromText(ContextMethodBuilder mb)
Generate code to convert String representation. |
abstract void |
genParseOptional(boolean attr,
ContextMethodBuilder mb)
Generate code to parse and convert optional attribute or element. |
abstract void |
genParseRequired(boolean attr,
ContextMethodBuilder mb)
Generate code to parse and convert required attribute or element. |
void |
genPopValues(int count,
ContextMethodBuilder mb)
Generate code to pop values from stack. |
protected abstract 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)
Generate code to convert value to a String. |
void |
genWriteOptional(boolean attr,
String type,
ContextMethodBuilder mb)
Generate code to convert and write optional value to generated document. |
void |
genWriteRequired(boolean attr,
String type,
ContextMethodBuilder mb)
Generate code to convert and write required value to generated document. |
void |
genWriteText(boolean attr,
ContextMethodBuilder mb)
Generate code to write String value to generated document. |
String |
getTypeName()
Get name of type handled by this conversion. |
abstract boolean |
isPrimitive()
Check if the type handled by this conversion is of a primitive type. |
protected void |
setDeserializer(String deser)
Set deserializer for conversion. |
protected void |
setSerializer(String ser,
boolean variant)
Set serializer for conversion. |
protected void |
setWhitespaceConverter(String wsconv)
Set whitespace converter for conversion. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String UNMARSHAL_OPT_ATTRIBUTE
protected static final String UNMARSHAL_OPT_ELEMENT
protected static final String UNMARSHAL_OPT_SIGNATURE
protected static final String UNMARSHAL_REQ_ATTRIBUTE
protected static final String UNMARSHAL_REQ_ELEMENT
protected static final String UNMARSHAL_REQ_SIGNATURE
protected static final String MARSHAL_ATTRIBUTE
protected static final String MARSHAL_ELEMENT
protected static final String MARSHAL_SIGNATURE
protected static final String COMPARE_OBJECTS_METHOD
protected static final String COMPARE_OBJECTS_SIGNATURE
protected static final String[] WHITESPACE_CONVERT_SIGNATURES
protected static final String[] DESERIALIZER_SIGNATURES
public static final int MARSHAL_NAME_VALUES
protected Object m_default
String or null).
protected ClassItem m_serializer
protected ClassItem m_converter
protected ClassItem m_deserializer
protected String m_typeName
protected String m_typeSignature
| Constructor Detail |
|---|
protected StringConversion(String type,
StringConversion inherit)
type - fully qualified name of class handled by conversioninherit - conversion information inherited by this conversion| Method Detail |
|---|
public String getTypeName()
public abstract void genFromText(ContextMethodBuilder mb)
throws 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.
mb - method builder
JiBXException - if error in configuration
public abstract void genParseOptional(boolean attr,
ContextMethodBuilder mb)
throws JiBXException
attr - item is an attribute (vs element) flagmb - method builder
JiBXException - if error in configuration
public abstract void genParseRequired(boolean attr,
ContextMethodBuilder mb)
throws JiBXException
attr - item is an attribute (vs element) flagmb - method builder
JiBXException - if error in configuration
public void genWriteText(boolean attr,
ContextMethodBuilder mb)
String value to generated document.
The code generated by this method assumes that the marshalling context,
the name information, and the actual value to be converted have already
been pushed on the stack. It consumes these, leaving the marshalling
context on the stack.
attr - item is an attribute (vs element) flagmb - method builder
public void genPopValues(int count,
ContextMethodBuilder mb)
count - number of values to be poppedmb - method builder
protected abstract BranchWrapper genToOptionalText(String type,
ContextMethodBuilder mb,
int extra)
throws JiBXException
type - fully qualified class name for value on stackmb - method builderextra - count of extra words to be popped from stack if missing
JiBXException - if error in configuration
public void genToText(String type,
ContextMethodBuilder mb)
throws JiBXException
String. 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.
type - fully qualified class name for value on stackmb - method builder
JiBXException - if error in configuration
public void genWriteOptional(boolean attr,
String type,
ContextMethodBuilder mb)
throws JiBXException
attr - item is an attribute (vs element) flagtype - fully qualified class name for value on stackmb - method builder
JiBXException - if error in configuration
public void genWriteRequired(boolean attr,
String type,
ContextMethodBuilder mb)
throws JiBXException
attr - item is an attribute (vs element) flagtype - fully qualified class name for value on stackmb - method builder
JiBXException - if error in configurationpublic abstract boolean isPrimitive()
true if a primitive type, false if an
object type
protected void setSerializer(String ser,
boolean variant)
throws JiBXException
String result.
ser - fully qualified class and method name of serializervariant - allow variants of the specified type
JiBXException - if serializer not found or not usable
protected void setWhitespaceConverter(String wsconv)
throws JiBXException
String, and to return the same.
wsconv - fully qualified class and method name of whitespace
converter
JiBXException - if whitespace converter not found or not usable
protected void setDeserializer(String deser)
throws JiBXException
String, and to return a value of the handled type or a
subtype of that type.
deser - fully qualified class and method name of deserializer
JiBXException - if deserializer not found or not usable
protected abstract Object convertDefault(String text)
throws JiBXException
text - value representation to be converted
JiBXException - on conversion error
public abstract StringConversion derive(String type,
String ser,
String conv,
String dser,
String dflt)
throws JiBXException
type - 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)
JiBXException - if error in configuration information
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||