public class FieldPath extends Object implements RecordSerializable, XmlSerializable, JavaCodeGenerator
parse(String) or programmatically by adding name (name(String))
and index (index(int)) segments to an instance.
For example, the field path customer.address[0].city can be created in two ways:
FieldPath.parse("customer.address[0].city")new FieldPath().name("customer").name("address").index(0).name("city")Other examples of parsed field paths include:
Identifiers in field expressions may start with letters, underscores (_), at symbols (@), or dollar signs ($) and contain letters, numbers, underscores, at symbols, and dollar signs. You will need to quote field expressions that contain other symbols and spaces if they should be treated as part of the field name. For example, if your field name contains a period, you will need to quote it ("Package Lbs.").
Quoting:When quoting fields, you can use double quotes ("), single quotes ('), or grave accent (`).
A note of caution: FieldPath can also represent the location of values in array fields. For example,
city[2] or customer.address[0].city[2] could match the third city in an array field. Some methods
and operations expecting a field will throw an exception (or return false) if the supplied FieldPath matches an array value
and not a field.
SERIALIZED_CLASS_NAME, TYPEXML_SERIALIZED_CLASS_NAME| Constructor and Description |
|---|
FieldPath() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Record record)
Deprecated.
|
boolean |
containsField(Record record) |
boolean |
containsNonNullField(Record record) |
boolean |
containsNonNullValue(Record record) |
boolean |
containsValue(Record record) |
boolean |
equals(Object o) |
FieldPath |
fromJson(InputStream inputStream) |
FieldPath |
fromJson(String json) |
static FieldPath |
fromName(String fieldName)
Converts a single field name into a FieldPath.
|
FieldPath |
fromRecord(Record source)
Loads this instance's state from a record and returns
this (for fluid API call chaining). |
FieldPath |
fromXml(InputStream inputStream) |
FieldPath |
fromXml(String xml) |
FieldPath |
fromXmlElement(Element element) |
void |
generateJavaCode(JavaCodeBuilder javaCodeBuilder) |
Field |
getField(Record record,
boolean create,
boolean throwException) |
Node |
getNode(Node rootNode,
boolean create,
boolean throwException) |
String |
getSimpleName()
Returns the name (or number/index) of the last segment in this path as a string.
|
SingleValue |
getSingleValue(Record record,
boolean create,
boolean throwException) |
Object |
getValue(ValueNode<?> recordOrArray,
boolean create,
boolean throwException) |
ValueNode<?> |
getValueNode(ValueNode<?> recordOrArray,
boolean create,
boolean throwException) |
int |
hashCode() |
FieldPath |
index(int index) |
boolean |
isTabular()
Indicates if this path matches against a flat record (i.e.
|
FieldPath |
name(String name)
Appends a new field name segment to this field path.
|
static FieldPath |
parse(String fieldPathExpression)
Converts a field path expression into a FieldPath object.
|
static FieldPath |
parse(String fieldPathExpression,
boolean failOnEmpty) |
ValueNode<?> |
setValue(ValueNode<?> parentNode,
boolean create,
boolean throwException,
Object value) |
String |
toExpression() |
Record |
toRecord() |
String |
toString() |
Element |
toXmlElement(Document document) |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitfromArrayValue, fromArrayValue, fromArrayValue, newInstanceFromRecord, newInstanceFromRecord, toArrayValue, toJson, toJson, toJson, toRecordnewInstanceFromJsonforEachGrandChildElement, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getChildElement, getChildElements, newInstanceFromXml, newInstanceFromXml, setAttribute, toXml, toXml, toXml, toXml, toXml, writeXml, writeXmlpublic static FieldPath parse(String fieldPathExpression)
Identifiers in field expressions may start with letters, underscores (_), at symbols (@), or dollar signs ($) and contain letters, numbers, underscores, at symbols, and dollar signs. You will need to quote field expressions that contain other symbols and spaces if they should be treated as part of the field name. For example, if your field name contains a period, you will need to quote it ("Package Lbs.").
Quoting:When quoting fields, you can use double quotes ("), single quotes ('), or grave accent (`).
public static FieldPath fromName(String fieldName)
public FieldPath index(int index)
public boolean isTabular()
public SingleValue getSingleValue(Record record, boolean create, boolean throwException)
public ValueNode<?> getValueNode(ValueNode<?> recordOrArray, boolean create, boolean throwException)
public ValueNode<?> setValue(ValueNode<?> parentNode, boolean create, boolean throwException, Object value)
public boolean containsField(Record record)
public boolean containsNonNullField(Record record)
@Deprecated public boolean contains(Record record)
containsValue(Record) instead.public boolean containsValue(Record record)
public boolean containsNonNullValue(Record record)
public String getSimpleName()
public String toExpression()
public Record toRecord()
toRecord in interface RecordSerializablepublic FieldPath fromRecord(Record source)
RecordSerializablethis (for fluid API call chaining).
For fluid API call chaining, the overridden method should change the declared return type to its class.fromRecord in interface RecordSerializablepublic Element toXmlElement(Document document)
toXmlElement in interface XmlSerializablepublic FieldPath fromXmlElement(Element element)
fromXmlElement in interface XmlSerializablepublic FieldPath fromXml(InputStream inputStream)
fromXml in interface XmlSerializablepublic FieldPath fromXml(String xml)
fromXml in interface XmlSerializablepublic FieldPath fromJson(InputStream inputStream)
fromJson in interface JsonSerializablefromJson in interface RecordSerializablepublic FieldPath fromJson(String json)
fromJson in interface JsonSerializablefromJson in interface RecordSerializablepublic void generateJavaCode(JavaCodeBuilder javaCodeBuilder)
generateJavaCode in interface JavaCodeGeneratorCopyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.