public class NameResolver
extends java.lang.Object
Resolver Implementation.
This class assists in resolving property names in the following five formats, with the layout of an identifying String in parentheses:
name) - The specified
name 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, so that (unless
overridden by a BeanInfo class, a property named "xyz"
will have a getter method named getXyz() or (for boolean
properties only) isXyz(), and a setter method named
setXyz().name1.name2.name3) The first
name element is used to select a property getter, as for simple
references above. The object returned for this property is then
consulted, using the same approach, for a property getter for a
property named name2, and so on. The property value that
is ultimately retrieved or modified is the one identified by the
last name element.name[index]) - The underlying
property value is assumed to be an array, or this JavaBean is assumed
to have indexed property getter and setter methods. The appropriate
(zero-relative) entry in the array is selected. List
objects are now also supported for read/write. You simply need to define
a getter that returns the Listname(key)) - The JavaBean
is assumed to have an property getter and setter methods with an
additional attribute of type java.lang.String.users(name=tom)) - The JavaBean
is assumed to have an property getter and setter methods with an
additional attribute of type java.lang.String.name1.name2[index].name3(key).users[name=n2]) -
Combining mapped, nested, and indexed references is also
supported.| 构造器和说明 |
|---|
NameResolver()
Default Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
java.lang.String |
getField(java.lang.String expression)
Return the search field name from the search expression or
null. |
int |
getIndex(java.lang.String expression)
Return the index value from the property expression or -3,-2,-1.
|
java.lang.String |
getKey(java.lang.String expression)
Return the map key from the property expression or
null. |
java.lang.String |
getProperty(java.lang.String expression)
Return the property name from the property expression.
|
java.lang.String |
getValue(java.lang.String expression)
Return the search value from the search expression or
null. |
boolean |
hasNested(java.lang.String expression)
Indicates whether or not the expression
contains nested property expressions or not.
|
boolean |
isIndexed(java.lang.String expression)
Indicate whether the expression is for an indexed property or not.
|
boolean |
isMapped(java.lang.String expression)
Indicate whether the expression is for a mapped property or not.
|
boolean |
isSearched(java.lang.String expression)
Indicate whether the expression is for an search property with field equal value or not.
|
java.lang.String |
next(java.lang.String expression)
Extract the next property expression from the
current expression.
|
java.lang.String |
nextRight(java.lang.String expression)
Extract the next property expression from the
current expression.
|
java.lang.String |
remove(java.lang.String expression)
Remove the last property expresson from the
current expression.
|
java.lang.String |
removeRight(java.lang.String expression)
Remove the right last property expresson from the
current expression.
|
public int getIndex(java.lang.String expression)
expression - The property expressionjava.lang.IllegalArgumentException - If the indexed property is illegally
formed or has an invalid (non-numeric) value.public java.lang.String getKey(java.lang.String expression)
null.expression - The property expressionjava.lang.IllegalArgumentException - If the mapped property is illegally formed.public java.lang.String getField(java.lang.String expression)
null.expression - The property expressionpublic java.lang.String getValue(java.lang.String expression)
null.expression - The property expressionpublic java.lang.String getProperty(java.lang.String expression)
expression - The property expressionpublic boolean hasNested(java.lang.String expression)
expression - The property expressionpublic boolean isIndexed(java.lang.String expression)
expression - The property expressiontrue if the expresion is indexed,
otherwise falsepublic boolean isSearched(java.lang.String expression)
array[name=hello]expression - The property expressiontrue if the expresion is indexed,
otherwise falsepublic boolean isMapped(java.lang.String expression)
expression - The property expressiontrue if the expresion is mapped,
otherwise falsepublic java.lang.String next(java.lang.String expression)
expression - The property expressionpublic java.lang.String nextRight(java.lang.String expression)
expression - The property expressionpublic java.lang.String remove(java.lang.String expression)
expression - The property expressionpublic java.lang.String removeRight(java.lang.String expression)
expression - The property expressionCopyright © 2023. All Rights Reserved.