类 PropertyAccessorUtils
- java.lang.Object
- org.springframework.beans.PropertyAccessorUtils
public abstract class PropertyAccessorUtils extends Object
Utility methods for classes that perform bean property access according to thePropertyAccessor
interface.- 从以下版本开始:
- 1.2.6
- 作者:
- Juergen Hoeller
构造器概要
构造器 构造器 说明 PropertyAccessorUtils()
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 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.static boolean
isNestedOrIndexedProperty(String propertyPath)
Check whether the given property path indicates an indexed or nested property.static boolean
matchesProperty(String registeredPath, String propertyPath)
Determine whether the given registered path matches the given property path, either indicating the property itself or an indexed element of the property.
构造器详细资料
PropertyAccessorUtils
public PropertyAccessorUtils()
方法详细资料
getPropertyName
public static String getPropertyName(String propertyPath)
Return the actual property name for the given property path.- 参数:
propertyPath
- the property path to determine the property name for (can include property keys, for example for specifying a map entry)- 返回:
- the actual property name, without any key elements
isNestedOrIndexedProperty
public static boolean isNestedOrIndexedProperty(String propertyPath)
Check whether the given property path indicates an indexed or nested property.- 参数:
propertyPath
- the property path to check- 返回:
- whether the path indicates an indexed or nested property
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]").- 参数:
propertyPath
- the property path to check- 返回:
- 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]").- 参数:
propertyPath
- the property path to check- 返回:
- the index of the nested property separator, or -1 if none
matchesProperty
public static boolean matchesProperty(String registeredPath, String propertyPath)
Determine whether the given registered path matches the given property path, either indicating the property itself or an indexed element of the property.- 参数:
propertyPath
- the property path (typically without index)registeredPath
- the registered path (potentially with index)- 返回:
- whether the paths match
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]
- 参数:
propertyName
- the bean property path- 返回:
- the canonical representation of the property path
canonicalPropertyNames
public static String[] canonicalPropertyNames(String[] propertyNames)
Determine the canonical names for the given property paths.- 参数:
propertyNames
- the bean property paths (as array)- 返回:
- the canonical representation of the property paths (as array of the same size)
- 另请参阅:
canonicalPropertyName(String)