org.springframework.beans
Class PropertyAccessorUtils

java.lang.Object
  extended by org.springframework.beans.PropertyAccessorUtils

public abstract class PropertyAccessorUtils
extends Object

Utility methods for classes that perform bean property access according to the PropertyAccessor interface.

Since:
1.2.6
Author:
Juergen Hoeller
See Also:
PropertyAccessor

Constructor Summary
PropertyAccessorUtils()
           
 
Method Summary
static String canonicalPropertyName(String propertyName)
          Determine the canonical name for the given property path.
static String[] canonicalPropertyNames(String[] propertyNames)
          Determine the canonical names for the given property paths.
static int getFirstNestedPropertySeparatorIndex(String propertyPath)
          Determine the first nested property separator in the given property path, ignoring dots in keys (like "map[my.key]").
static int getLastNestedPropertySeparatorIndex(String propertyPath)
          Determine the first nested property separator in the given property path, ignoring dots in keys (like "map[my.key]").
static String getPropertyName(String propertyPath)
          Return the actual property name for the given property path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyAccessorUtils

public PropertyAccessorUtils()
Method Detail

getPropertyName

public static String getPropertyName(String propertyPath)
Return the actual property name for the given property path.

Parameters:
propertyPath - the property path to determine the property name for (can include property keys, for example for specifying a map entry)
Returns:
the actual property name, without any key elements

getFirstNestedPropertySeparatorIndex

public static int getFirstNestedPropertySeparatorIndex(String propertyPath)
Determine the first nested property separator in the given property path, ignoring dots in keys (like "map[my.key]").

Parameters:
propertyPath - the property path to check
Returns:
the index of the nested property separator, or -1 if none

getLastNestedPropertySeparatorIndex

public static int getLastNestedPropertySeparatorIndex(String propertyPath)
Determine the first nested property separator in the given property path, ignoring dots in keys (like "map[my.key]").

Parameters:
propertyPath - the property path to check
Returns:
the index of the nested property separator, or -1 if none

canonicalPropertyName

public static String canonicalPropertyName(String propertyName)
Determine the canonical name for the given property path. Removes surrounding quotes from map keys:
map['key'] -> map[key]
map["key"] -> map[key]

Parameters:
propertyName - the bean property path
Returns:
the canonical representation of the property path

canonicalPropertyNames

public static String[] canonicalPropertyNames(String[] propertyNames)
Determine the canonical names for the given property paths.

Parameters:
propertyNames - the bean property paths (as array)
Returns:
the canonical representation of the property paths (as array of the same size)
See Also:
canonicalPropertyName(String)


Copyright (c) 2002-2007 The Spring Framework Project.