|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.beans.PropertyMatches
final class PropertyMatches
Helper class for calculating bean property matches, according to. Used by BeanWrapperImpl to suggest alternatives for an invalid property name.
forProperty(String, Class)| Field Summary | |
|---|---|
static int |
DEFAULT_MAX_DISTANCE
Default maximum property distance: 2 |
private java.lang.String[] |
possibleMatches
|
private java.lang.String |
propertyName
|
| Constructor Summary | |
|---|---|
private |
PropertyMatches(java.lang.String propertyName,
java.lang.Class beanClass,
int maxDistance)
Create a new PropertyMatches instance for the given property. |
| Method Summary | |
|---|---|
java.lang.String |
buildErrorMessage()
Build an error message for the given invalid property name, indicating the possible property matches. |
private java.lang.String[] |
calculateMatches(java.beans.PropertyDescriptor[] propertyDescriptors,
int maxDistance)
Generate possible property alternatives for the given property and class. |
private int |
calculateStringDistance(java.lang.String s1,
java.lang.String s2)
Calculate the distance between the given two Strings according to the Levenshtein algorithm. |
static PropertyMatches |
forProperty(java.lang.String propertyName,
java.lang.Class beanClass)
Create PropertyMatches for the given bean property. |
static PropertyMatches |
forProperty(java.lang.String propertyName,
java.lang.Class beanClass,
int maxDistance)
Create PropertyMatches for the given bean property. |
java.lang.String[] |
getPossibleMatches()
Return the calculated possible matches. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_MAX_DISTANCE
private final java.lang.String propertyName
private java.lang.String[] possibleMatches
| Constructor Detail |
|---|
private PropertyMatches(java.lang.String propertyName,
java.lang.Class beanClass,
int maxDistance)
| Method Detail |
|---|
public static PropertyMatches forProperty(java.lang.String propertyName,
java.lang.Class beanClass)
propertyName - the name of the property to find possible matches forbeanClass - the bean class to search for matches
public static PropertyMatches forProperty(java.lang.String propertyName,
java.lang.Class beanClass,
int maxDistance)
propertyName - the name of the property to find possible matches forbeanClass - the bean class to search for matchesmaxDistance - the maximum property distance allowed for matchespublic java.lang.String[] getPossibleMatches()
public java.lang.String buildErrorMessage()
private java.lang.String[] calculateMatches(java.beans.PropertyDescriptor[] propertyDescriptors,
int maxDistance)
getStringDistance method, which
in turn uses the Levenshtein algorithm to determine the distance between
two Strings.
propertyDescriptors - the JavaBeans property descriptors to searchmaxDistance - the maximum distance to accept
private int calculateStringDistance(java.lang.String s1,
java.lang.String s2)
s1 - the first Strings2 - the second String
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||