public class FieldPath extends Object
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.
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) |
static FieldPath |
fromName(String fieldName)
Converts a single field name into a FieldPath.
|
Field |
getField(Record record,
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(Record record,
boolean create,
boolean throwException) |
ValueNode<?> |
getValueNode(Record record,
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.
|
String |
toString() |
public 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(Record record, boolean create, boolean throwException)
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()
Copyright (c) 2006-2023 North Concepts Inc. All Rights Reserved.