spring-framework / org.springframework.beans / PropertyMatches

PropertyMatches

abstract class PropertyMatches

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.

Author
Alef Arendsen

Author
Arjen Poutsma

Author
Juergen Hoeller

Author
Stephane Nicoll

Since
2.0

See Also
#forProperty(String, Class)#forField(String, Class)

Properties

DEFAULT_MAX_DISTANCE

static val DEFAULT_MAX_DISTANCE: Int

Default maximum property distance: 2

Functions

buildErrorMessage

abstract fun buildErrorMessage(): String

Build an error message for the given invalid property name, indicating the possible property matches.

forField

open static fun forField(propertyName: String, beanClass: Class<*>): PropertyMatches
open static fun forField(propertyName: String, beanClass: Class<*>, maxDistance: Int): PropertyMatches

Create PropertyMatches for the given field property.

forProperty

open static fun forProperty(propertyName: String, beanClass: Class<*>): PropertyMatches
open static fun forProperty(propertyName: String, beanClass: Class<*>, maxDistance: Int): PropertyMatches

Create PropertyMatches for the given bean property.

getPossibleMatches

open fun getPossibleMatches(): Array<String>

Return the calculated possible matches.

getPropertyName

open fun getPropertyName(): String

Return the name of the requested property.