|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.internal.parser.format.xml.XmlFieldFormat
public abstract class XmlFieldFormat
Base class for XML FieldFormat
implementations.
Field Summary |
---|
Fields inherited from interface org.beanio.internal.parser.format.xml.XmlNode |
---|
XML_TYPE_ATTRIBUTE, XML_TYPE_ELEMENT, XML_TYPE_NONE, XML_TYPE_TEXT |
Constructor Summary | |
---|---|
XmlFieldFormat()
Constructs a new XmlFieldFormat. |
Method Summary | |
---|---|
String |
extract(UnmarshallingContext context,
boolean reportErrors)
Extracts the field text from a record. |
protected abstract String |
extractText(XmlUnmarshallingContext context)
Extracts a field from a record during unmarshalling. |
String |
getName()
Returns the field name. |
FieldPadding |
getPadding()
Returns the field padding, or null if the field text is not padded. |
int |
getSize()
Returns the size of the field. |
void |
insertField(MarshallingContext context,
String fieldText)
Inserts field text into a record. |
protected abstract void |
insertText(XmlMarshallingContext context,
String text)
Inserts a field into the record during marshalling. |
boolean |
insertValue(MarshallingContext context,
Object value)
Inserts a value into a record. |
boolean |
isLazy()
TODO rename isLazy to something better?? Returns whether this field is optionally present in the record. |
void |
setLazy(boolean lazy)
|
void |
setName(String name)
Sets the field name. |
void |
setPadding(FieldPadding padding)
Sets the field padding. |
protected void |
toParamString(StringBuilder s)
Called by toString() to append attributes of this field. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.beanio.internal.parser.FieldFormat |
---|
isNillable |
Methods inherited from interface org.beanio.internal.parser.format.xml.XmlNode |
---|
getLocalName, getNamespace, getPrefix, getType, isNamespaceAware, isNillable, isRepeating |
Constructor Detail |
---|
public XmlFieldFormat()
Method Detail |
---|
public boolean insertValue(MarshallingContext context, Object value)
FieldFormat
FieldFormat.insertField(MarshallingContext, String)
is called. If the method returns true, FieldFormat.insertField(MarshallingContext, String)
is not invoked.
insertValue
in interface FieldFormat
context
- the MarshallingContext
value
- the value to insert into the record
FieldFormat.insertField(MarshallingContext, String)
must be invoked, false otherwisepublic void insertField(MarshallingContext context, String fieldText)
FieldFormat
insertField
in interface FieldFormat
context
- the MarshallingContext
holding the recordfieldText
- the field text to insert into the recordprotected abstract void insertText(XmlMarshallingContext context, String text)
context
- the XmlMarshallingContext
holding the recordtext
- the field text to insertpublic String extract(UnmarshallingContext context, boolean reportErrors)
FieldFormat
May return Value.INVALID
if the field is invalid, or Value.NIL
if the field is explicitly set to nil or null such as in an XML or JSON formatted
stream.
Implementations should also remove any field padding before returning the text.
extract
in interface FieldFormat
context
- the UnmarshallingContext
holding the record
protected abstract String extractText(XmlUnmarshallingContext context)
context
- the XmlUnmarshallingContext
holding the record
public int getSize()
FieldFormat
getSize
in interface FieldFormat
public String getName()
public void setName(String name)
name
- the field namepublic boolean isLazy()
FieldFormat
isLazy
in interface FieldFormat
public void setLazy(boolean lazy)
public FieldPadding getPadding()
public void setPadding(FieldPadding padding)
padding
- the field paddingprotected void toParamString(StringBuilder s)
toString()
to append attributes of this field.
s
- the text to appendpublic String toString()
toString
in class Object
|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |