org.apache.commons.beanutils.expression

Class DefaultResolver

Implemented Interfaces:
Resolver

public class DefaultResolver
extends java.lang.Object
implements Resolver

Default Property Name Expression Resolver Implementation.

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

Version:
$Revision: 473888 $ $Date: 2006-11-12 06:21:24 +0000 (Sun, 12 Nov 2006) $
Since:
1.8.0

Field Summary

private static char
INDEXED_END
private static char
INDEXED_START
private static char
MAPPED_END
private static char
MAPPED_START
private static char
NESTED

Constructor Summary

DefaultResolver()
Default Constructor.

Method Summary

int
getIndex(String expression)
Return the index value from the property expression or -1.
String
getKey(String expression)
Return the map key from the property expression or null.
String
getProperty(String expression)
Return the property name from the property expression.
boolean
hasNested(String expression)
Indicates whether or not the expression contains nested property expressions or not.
boolean
isIndexed(String expression)
Indicate whether the expression is for an indexed property or not.
boolean
isMapped(String expression)
Indicate whether the expression is for a mapped property or not.
String
next(String expression)
Extract the next property expression from the current expression.
String
remove(String expression)
Remove the last property expresson from the current expression.

Field Details

INDEXED_END

private static final char INDEXED_END
Field Value:
']'

INDEXED_START

private static final char INDEXED_START
Field Value:
'['

MAPPED_END

private static final char MAPPED_END
Field Value:
')'

MAPPED_START

private static final char MAPPED_START
Field Value:
'('

NESTED

private static final char NESTED
Field Value:
'.'

Constructor Details

DefaultResolver

public DefaultResolver()
Default Constructor.

Method Details

getIndex

public int getIndex(String expression)
Return the index value from the property expression or -1.
Specified by:
getIndex in interface Resolver
Parameters:
expression - The property expression
Returns:
The index value or -1 if the property is not indexed

getKey

public String getKey(String expression)
Return the map key from the property expression or null.
Specified by:
getKey in interface Resolver
Parameters:
expression - The property expression
Returns:
The index value

getProperty

public String getProperty(String expression)
Return the property name from the property expression.
Specified by:
getProperty in interface Resolver
Parameters:
expression - The property expression
Returns:
The property name

hasNested

public boolean hasNested(String expression)
Indicates whether or not the expression contains nested property expressions or not.
Specified by:
hasNested in interface Resolver
Parameters:
expression - The property expression
Returns:
The next property expression

isIndexed

public boolean isIndexed(String expression)
Indicate whether the expression is for an indexed property or not.
Specified by:
isIndexed in interface Resolver
Parameters:
expression - The property expression
Returns:
true if the expresion is indexed, otherwise false

isMapped

public boolean isMapped(String expression)
Indicate whether the expression is for a mapped property or not.
Specified by:
isMapped in interface Resolver
Parameters:
expression - The property expression
Returns:
true if the expresion is mapped, otherwise false

next

public String next(String expression)
Extract the next property expression from the current expression.
Specified by:
next in interface Resolver
Parameters:
expression - The property expression
Returns:
The next property expression

remove

public String remove(String expression)
Remove the last property expresson from the current expression.
Specified by:
remove in interface Resolver
Parameters:
expression - The property expression
Returns:
The new expression value, with first property expression removed - null if there are no more expressions

Copyright (c) 2001-2007 - Apache Software Foundation