public class JsonFieldFormat extends Object implements FieldFormat, JsonNode
FieldFormat implementation for a field in a JSON formatted record.| Constructor and Description |
|---|
JsonFieldFormat()
Constructs a new JsonFieldFormat.
|
| Modifier and Type | Method and Description |
|---|---|
String |
extract(UnmarshallingContext context,
boolean reportErrors)
Extracts the field text from a record.
|
int |
getJsonArrayIndex()
Returns the index of this node in its parent array, or -1 if not applicable
(i.e.
|
String |
getJsonName()
Returns the JSON field name.
|
char |
getJsonType()
Returns the type of node.
|
String |
getName()
Returns the field name.
|
FieldPadding |
getPadding() |
int |
getSize()
Returns the size of the field.
|
void |
insertField(MarshallingContext context,
String text)
Inserts field text into a record.
|
boolean |
insertValue(MarshallingContext context,
Object value)
Inserts a value into a record.
|
boolean |
isBypassTypeHandler() |
boolean |
isJsonArray()
Returns whether this node is a JSON array.
|
boolean |
isLazy()
TODO rename isLazy to something better??
Returns whether this field is optionally present in the record.
|
boolean |
isNillable()
Returns whether this field is nillable.
|
void |
setBypassTypeHandler(boolean bypassTypeHandler) |
void |
setJsonArray(boolean repeating) |
void |
setJsonArrayIndex(int jsonArrayIndex) |
void |
setJsonName(String jsonName) |
void |
setJsonType(char jsonType) |
void |
setLazy(boolean lazy) |
void |
setName(String name) |
void |
setNillable(boolean nillable) |
void |
setPadding(FieldPadding padding) |
String |
toString() |
public String extract(UnmarshallingContext context, boolean reportErrors)
FieldFormatMay 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 FieldFormatcontext - the UnmarshallingContext holding the recordpublic boolean insertValue(MarshallingContext context, Object value)
FieldFormatFieldFormat.insertField(MarshallingContext, String)
is called. If the method returns true, FieldFormat.insertField(MarshallingContext, String)
is not invoked.insertValue in interface FieldFormatcontext - the MarshallingContextvalue - the value to insert into the recordFieldFormat.insertField(MarshallingContext, String)
must be invoked, false otherwisepublic void insertField(MarshallingContext context, String text)
FieldFormatinsertField in interface FieldFormatcontext - the MarshallingContext holding the recordtext - the field text to insert into the recordpublic void setName(String name)
name - public void setLazy(boolean lazy)
lazy - public int getSize()
FieldFormatgetSize in interface FieldFormatpublic void setNillable(boolean nillable)
nillable - public boolean isNillable()
FieldFormatisNillable in interface FieldFormatisNillable in interface JsonNodepublic boolean isLazy()
FieldFormatisLazy in interface FieldFormatpublic void setJsonName(String jsonName)
jsonName - public String getJsonName()
JsonNodegetJsonName in interface JsonNodepublic void setJsonType(char jsonType)
jsonType - public char getJsonType()
JsonNodeJsonNode.isJsonArray() is true, this method
returns the component type of the array.getJsonType in interface JsonNodepublic void setJsonArray(boolean repeating)
public boolean isJsonArray()
JsonNodeisJsonArray in interface JsonNodepublic int getJsonArrayIndex()
JsonNodegetJsonArrayIndex in interface JsonNodepublic void setJsonArrayIndex(int jsonArrayIndex)
public FieldPadding getPadding()
public void setPadding(FieldPadding padding)
public boolean isBypassTypeHandler()
public void setBypassTypeHandler(boolean bypassTypeHandler)