类 PropertyMatches


  • public abstract class PropertyMatches
    extends Object
    Helper class for calculating property matches, according to a configurable distance. Provide the list of potential matches and an easy way to generate an error message. Works for both java bean properties and fields.

    Mainly for use within the framework and in particular the binding facility.

    从以下版本开始:
    2.0
    作者:
    Alef Arendsen, Arjen Poutsma, Juergen Hoeller, Stephane Nicoll
    另请参阅:
    forProperty(String, Class), forField(String, Class)
    • 方法详细资料

      • forProperty

        public static PropertyMatches forProperty​(String propertyName,
                                                  Class<?> beanClass)
        Create PropertyMatches for the given bean property.
        参数:
        propertyName - the name of the property to find possible matches for
        beanClass - the bean class to search for matches
      • forProperty

        public static PropertyMatches forProperty​(String propertyName,
                                                  Class<?> beanClass,
                                                  int maxDistance)
        Create PropertyMatches for the given bean property.
        参数:
        propertyName - the name of the property to find possible matches for
        beanClass - the bean class to search for matches
        maxDistance - the maximum property distance allowed for matches
      • forField

        public static PropertyMatches forField​(String propertyName,
                                               Class<?> beanClass)
        Create PropertyMatches for the given field property.
        参数:
        propertyName - the name of the field to find possible matches for
        beanClass - the bean class to search for matches
      • forField

        public static PropertyMatches forField​(String propertyName,
                                               Class<?> beanClass,
                                               int maxDistance)
        Create PropertyMatches for the given field property.
        参数:
        propertyName - the name of the field to find possible matches for
        beanClass - the bean class to search for matches
        maxDistance - the maximum property distance allowed for matches
      • buildErrorMessage

        public abstract String buildErrorMessage()
        Build an error message for the given invalid property name, indicating the possible property matches.