PropertyNameResolver

Default Property Name Resolver .

This class assists in resolving property names in the following four formats, with the layout of an identifying String in parentheses:

  • <strong>Simple (<code>name</code>)</strong> - The specified <code>name</code> identifies an individual property of a particular JavaBean. The name of the actual getter or setter method to be used is determined using standard JavaBeans instrospection, a property named "xyz" will have a getter method named <code>getXyz()</code> or (for boolean properties only) <code>isXyz()</code>, and a setter method named <code>setXyz()</code>.

  • <strong>Indexed (<code>name[index]</code>)</strong> - The underlying property value is assumed to be an array. The appropriate (zero-relative) entry in the array is selected. <code>List</code> objects are now also supported for read/write.

  • <strong>Mapped (<code>name(key)</code>)</strong> - The JavaBean is assumed to have an property getter and setter methods with an additional attribute of type <code>java.lang.String</code>.

  • <strong>Nested (<code>name1.name2[index].name3(key)</code>)</strong> - Combining mapped, nested, and indexed references is also supported.

Since

3.2.0

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def getIndex(expression: String): Int

Return the index value from the property expression or -1.

Return the index value from the property expression or -1.

Value Params
expression

The property expression

Returns

The index value or -1 if the property is not indexed

Throws
IllegalArgumentException

If the indexed property is illegally formed or has an invalid (non-numeric) value.

def getKey(expression: String): String

Return the map key from the property expression or <code>null</code>.

Return the map key from the property expression or <code>null</code>.

Value Params
expression

The property expression

Returns

The index value

Throws
IllegalArgumentException

If the mapped property is illegally formed.

def getProperty(expression: String): String

Return the property name from the property expression.

Return the property name from the property expression.

Value Params
expression

The property expression

Returns

The property name

def hasNested(expression: String): Boolean

Indicates whether or not the expression contains nested property expressions or not.

Indicates whether or not the expression contains nested property expressions or not.

Value Params
expression

The property expression

Returns

The next property expression

def isIndexed(expression: String): Boolean

Indicate whether the expression is for an indexed property or not.

Indicate whether the expression is for an indexed property or not.

Value Params
expression

The property expression

Returns

<code>true</code> if the expresion is indexed, otherwise <code>false</code>

def isMapped(expression: String): Boolean

Indicate whether the expression is for a mapped property or not.

Indicate whether the expression is for a mapped property or not.

Value Params
expression

The property expression

Returns

<code>true</code> if the expresion is mapped, otherwise <code>false</code>

def next(expression: String): String

Extract the next property expression from the current expression.

Extract the next property expression from the current expression.

Value Params
expression

The property expression

Returns

The next property expression

def remove(expression: String): String

Remove the last property expresson from the current expression.

Remove the last property expresson from the current expression.

Value Params
expression

The property expression

Returns

The new expression value, with first property expression removed - null if there are no more expressions