|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jibx.binding.def.StringConversion
org.jibx.binding.def.PrimitiveStringConversion
public class PrimitiveStringConversion
Primitive string conversion handling. Class for handling serialization
converting a primitive type to and from String values.
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
|
PrimitiveStringConversion(Class cls,
Object dflt,
String code,
String ts,
String fs,
String uattr,
String uelem)
Constructor. |
protected |
PrimitiveStringConversion(String type,
PrimitiveStringConversion inherit)
Constructor. |
| Method Summary | |
|---|---|
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. |
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(String deser)
Set deserializer for conversion. |
protected void |
setSerializer(String ser)
Set serializer for conversion. |
protected void |
setWhitespaceConverter(String wsconv)
Set whitespace converter for conversion. |
| Methods inherited from class org.jibx.binding.def.StringConversion |
|---|
genPopValues, genToText, genWriteOptional, genWriteRequired, genWriteText, getTypeName, setSerializer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected PrimitiveStringConversion(String type,
PrimitiveStringConversion inherit)
type - name of primitive type handled by conversioninherit - conversion information inherited by this conversion
public PrimitiveStringConversion(Class cls,
Object dflt,
String code,
String ts,
String fs,
String uattr,
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
Stringfs - name of utility class static method for converting
String to valueuattr - unmarshalling context method name for attribute valueuelem - unmarshalling context method name for element value| Method Detail |
|---|
public 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 StringConversionmb - method builderprotected void pushDefault(ContextMethodBuilder mb)
mb - method builder
public void genParseOptional(boolean attr,
ContextMethodBuilder mb)
throws JiBXException
genParseOptional in class StringConversionattr - item is an attribute (vs element) flagmb - method builder
JiBXException - if error in configuration
public void genParseRequired(boolean attr,
ContextMethodBuilder mb)
throws JiBXException
genParseRequired in class StringConversionattr - item is an attribute (vs element) flagmb - method builder
JiBXException - if error in configuration
protected BranchWrapper genToOptionalText(String type,
ContextMethodBuilder mb,
int extra)
throws 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 missing
JiBXException - if error in configuration
protected Object convertDefault(String text)
throws JiBXException
String value directly.
convertDefault in class StringConversiontext - value representation to be converted
JiBXException - on conversion errorpublic boolean isPrimitive()
isPrimitive in class StringConversiontrue to indicate primitive type
protected void setSerializer(String ser)
throws JiBXException
ser - fully qualified class and method name of serializer
JiBXException - if serializer not found or not usable
protected void setWhitespaceConverter(String wsconv)
throws JiBXException
setWhitespaceConverter in class StringConversionwsconv - 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
setDeserializer in class StringConversiondeser - fully qualified class and method name of deserializer
JiBXException - if deserializer not found or not usable
public StringConversion derive(String type,
String ser,
String conv,
String dser,
String dflt)
throws 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)
JiBXException - if error in configuration information
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||