public class PrimitiveStringConversion extends StringConversion
String
values.Modifier and Type | Field and Description |
---|---|
private static int |
DOUBLE_TYPE |
private static int |
FLOAT_TYPE |
private static int |
INT_TYPE |
private static int |
LONG_TYPE |
private boolean |
m_isMarshalText
Marshalling requires conversion to text flag.
|
private boolean |
m_isUnmarshalText
Unmarshalling requires conversion to text flag.
|
private java.lang.String |
m_stackType
Name of value type on stack.
|
private ClassItem |
m_unmarshalOptAttribute
Unmarshalling context method for optional attribute.
|
private ClassItem |
m_unmarshalOptElement
Unmarshalling context method for optional element.
|
private ClassItem |
m_unmarshalReqAttribute
Unmarshalling context method for required attribute.
|
private ClassItem |
m_unmarshalReqElement
Unmarshalling context method for required element.
|
private int |
m_valueType
Comparison and marshal type of value (INT_TYPE, LONG_TYPE, FLOAT_TYPE,
or DOUBLE_TYPE)
|
private static ClassFile |
s_unmarshalClass |
private static java.lang.Class[] |
SINGLE_STRING_ARGS
Constant argument type array for finding conversion methods.
|
private static java.lang.String |
UNMARSHAL_SIG_LEAD
Unmarshal method signature leading portion.
|
private static java.lang.String |
UTILITY_CLASS_NAME
Class providing basic conversion methods.
|
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 | Constructor and Description |
---|---|
|
PrimitiveStringConversion(java.lang.Class cls,
java.lang.Object dflt,
java.lang.String code,
java.lang.String ts,
java.lang.String fs,
java.lang.String uattr,
java.lang.String uelem)
Constructor.
|
protected |
PrimitiveStringConversion(java.lang.String type,
PrimitiveStringConversion inherit)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
convertDefault(java.lang.String text)
Convert text representation into default value object.
|
StringConversion |
derive(java.lang.String type,
java.lang.String ser,
java.lang.String conv,
java.lang.String dser,
java.lang.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(java.lang.String type,
ContextMethodBuilder mb,
int extra)
Generate code to check if an optional value is not equal to the default.
|
boolean |
isPrimitive()
Check if the type handled by this conversion is of a primitive type.
|
protected void |
pushDefault(ContextMethodBuilder mb)
Push default value on stack.
|
protected void |
setDeserializer(java.lang.String deser)
Set deserializer for conversion.
|
protected void |
setSerializer(java.lang.String ser)
Set serializer for conversion.
|
protected void |
setWhitespaceConverter(java.lang.String wsconv)
Set whitespace converter for conversion.
|
genPopValues, genToText, genWriteOptional, genWriteRequired, genWriteText, getTypeName, setSerializer
private static ClassFile s_unmarshalClass
private static final int INT_TYPE
private static final int LONG_TYPE
private static final int FLOAT_TYPE
private static final int DOUBLE_TYPE
private static final java.lang.String UTILITY_CLASS_NAME
private static final java.lang.String UNMARSHAL_SIG_LEAD
private static final java.lang.Class[] SINGLE_STRING_ARGS
private boolean m_isMarshalText
private boolean m_isUnmarshalText
private ClassItem m_unmarshalOptAttribute
private ClassItem m_unmarshalOptElement
private ClassItem m_unmarshalReqAttribute
private ClassItem m_unmarshalReqElement
private int m_valueType
private java.lang.String m_stackType
protected PrimitiveStringConversion(java.lang.String type, PrimitiveStringConversion inherit)
type
- name of primitive type handled by conversioninherit
- conversion information inherited by this conversionpublic PrimitiveStringConversion(java.lang.Class cls, java.lang.Object dflt, java.lang.String code, java.lang.String ts, java.lang.String fs, java.lang.String uattr, java.lang.String uelem)
cls
- class of primitive type handled by conversiondflt
- default value object (wrapped value, or String
or null
with special deserializer)code
- primitive type codets
- name of utility class static method for converting value to
String
fs
- name of utility class static method for converting
String
to valueuattr
- unmarshalling context method name for attribute valueuelem
- unmarshalling context method name for element valuepublic void genFromText(ContextMethodBuilder mb)
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 StringConversion
mb
- method builderprotected void pushDefault(ContextMethodBuilder mb)
mb
- method builderpublic void genParseOptional(boolean attr, ContextMethodBuilder mb) throws JiBXException
genParseOptional
in class StringConversion
attr
- item is an attribute (vs element) flagmb
- method builderJiBXException
- if error in configurationpublic void genParseRequired(boolean attr, ContextMethodBuilder mb) throws JiBXException
genParseRequired
in class StringConversion
attr
- item is an attribute (vs element) flagmb
- method builderJiBXException
- if error in configurationprotected BranchWrapper genToOptionalText(java.lang.String type, ContextMethodBuilder mb, int extra) throws JiBXException
genToOptionalText
in class StringConversion
type
- fully qualified class name for value on stackmb
- method builderextra
- count of extra values to be popped from stack if missingJiBXException
- if error in configurationprotected java.lang.Object convertDefault(java.lang.String text) throws JiBXException
String
value directly.convertDefault
in class StringConversion
text
- value representation to be convertedJiBXException
- on conversion errorpublic boolean isPrimitive()
isPrimitive
in class StringConversion
true
to indicate primitive typeprotected void setSerializer(java.lang.String ser) throws JiBXException
ser
- fully qualified class and method name of serializerJiBXException
- if serializer not found or not usableprotected void setWhitespaceConverter(java.lang.String wsconv) throws JiBXException
setWhitespaceConverter
in class StringConversion
wsconv
- fully qualified class and method name of whitespace
converterJiBXException
- if whitespace converter not found or not usableprotected void setDeserializer(java.lang.String deser) throws JiBXException
setDeserializer
in class StringConversion
deser
- fully qualified class and method name of deserializerJiBXException
- if deserializer not found or not usablepublic StringConversion derive(java.lang.String type, java.lang.String ser, java.lang.String conv, java.lang.String dser, java.lang.String dflt) throws JiBXException
derive
in class StringConversion
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