Top Description Constructors Methods
org.springframework.beans

public abstract Class PropertyAccessorUtils

extends Object
Class Inheritance
Imports
org.springframework.lang.Nullable

Utility methods for classes that perform bean property access according to the PropertyAccessor interface.
Author
Juergen Hoeller
Since
1.2.6

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

the canonical representation of the property path
canonicalPropertyName
(String
the bean property path
propertyName
)

Determine the canonical name for the given property path.

public static String[]

Returns:

the canonical representation of the property paths (as array of the same size)
canonicalPropertyNames
(String[]
the bean property paths (as array)
propertyNames
)

Determine the canonical names for the given property paths.

public static int

Returns:

the index of the nested property separator, or -1 if none
getFirstNestedPropertySeparatorIndex
(String
the property path to check
propertyPath
)

Determine the first nested property separator in the given property path, ignoring dots in keys (like "map[my.key]").

public static int

Returns:

the index of the nested property separator, or -1 if none
getLastNestedPropertySeparatorIndex
(String
the property path to check
propertyPath
)

Determine the first nested property separator in the given property path, ignoring dots in keys (like "map[my.key]").

private static int

Returns:

the index of the nested property separator, or -1 if none
getNestedPropertySeparatorIndex
(String
the property path to check
propertyPath
,
boolean
whether to return the last separator rather than the first
last
)

Determine the first (or last) nested property separator in the given property path, ignoring dots in keys (like "map[my.key]").

public static String

Returns:

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

Return the actual property name for the given property path.

public static boolean

Returns:

whether the path indicates an indexed or nested property
isNestedOrIndexedProperty
(String
the property path to check
propertyPath
)

Check whether the given property path indicates an indexed or nested property.

public static boolean

Returns:

whether the paths match
matchesProperty
(String
the registered path (potentially with index)
registeredPath
,
String
the property path (typically without index)
propertyPath
)

Determine whether the given registered path matches the given property path, either indicating the property itself or an indexed element of the property.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

PropertyAccessorUtilsback to summary
public PropertyAccessorUtils()

Method Detail

canonicalPropertyNameback to summary
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:String

the bean property path

Returns:String

the canonical representation of the property path

canonicalPropertyNamesback to summary
public static String[] canonicalPropertyNames(String[] propertyNames)

Determine the canonical names for the given property paths.

Parameters
propertyNames:String[]

the bean property paths (as array)

Returns:String[]

the canonical representation of the property paths (as array of the same size)

Annotations
@Nullable
See Also
canonicalPropertyName(String)
getFirstNestedPropertySeparatorIndexback to summary
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:String

the property path to check

Returns:int

the index of the nested property separator, or -1 if none

getLastNestedPropertySeparatorIndexback to summary
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:String

the property path to check

Returns:int

the index of the nested property separator, or -1 if none

getNestedPropertySeparatorIndexback to summary
private static int getNestedPropertySeparatorIndex(String propertyPath, boolean last)

Determine the first (or last) nested property separator in the given property path, ignoring dots in keys (like "map[my.key]").

Parameters
propertyPath:String

the property path to check

last:boolean

whether to return the last separator rather than the first

Returns:int

the index of the nested property separator, or -1 if none

getPropertyNameback to summary
public static String getPropertyName(String propertyPath)

Return the actual property name for the given property path.

Parameters
propertyPath:String

the property path to determine the property name for (can include property keys, for example for specifying a map entry)

Returns:String

the actual property name, without any key elements

isNestedOrIndexedPropertyback to summary
public static boolean isNestedOrIndexedProperty(String propertyPath)

Check whether the given property path indicates an indexed or nested property.

Parameters
propertyPath:String

the property path to check

Returns:boolean

whether the path indicates an indexed or nested property

matchesPropertyback to summary
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.

Parameters
registeredPath:String

the registered path (potentially with index)

propertyPath:String

the property path (typically without index)

Returns:boolean

whether the paths match