P - the type of parent that this FieldAndVarReader can updateSectionReader<P>public class FieldAndVarReader<P> extends java.lang.Object implements SectionReader<P>
SectionReader that reads a value and injects it in a field of the parent object, and/or a context variable.| Constructor | Description |
|---|---|
FieldAndVarReader(java.lang.String fieldName,
java.lang.String variableName) |
Creates a new
FieldAndVarReader with the given field/variable names. |
| Modifier and Type | Method | Description |
|---|---|---|
void |
readAndSet(@NotNull Context context,
P object) |
Reads as much input as necessary to update the given object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsettingArray, settingChild, settingCollection, settingDouble, settingInt, settingList, settingObject, settingStringpublic FieldAndVarReader(java.lang.String fieldName,
java.lang.String variableName)
FieldAndVarReader with the given field/variable names.
Both the field and variable names are optional. If a field name is specified, the corresponding field is set to the parsed value, converted to the proper type. If a variable name is specified, the corresponding variable is set to the parsed value. If both are specified, then both are set to the same value, reading only one token from the input.
Specifying neither a field nor a variable name is valid. In this case, this reader consumes one token from the input nonetheless, but no fields nor variables are set as a result.
fieldName - the name of a field of the parent object, or null if no field should be set. The given field has to be of
a primitive type or string.variableName - the name of a variable to set, or null if no variable should be set.public void readAndSet(@NotNull
@NotNull Context context,
@Nullable
P object)
throws InputParsingException
SectionReaderreadAndSet in interface SectionReader<P>context - the context to read fromobject - the object to updateInputParsingException - if something went wrong while reading the input