Top Fields Constructors Methods
org.hibernate.validator.internal.properties

public Class DefaultGetterPropertySelectionStrategy

extends Object
implements GetterPropertySelectionStrategy
Class Inheritance
All Implemented Interfaces
org.hibernate.validator.spi.properties.GetterPropertySelectionStrategy
Imports
java.lang.invoke.MethodHandles, java.util.List, .Optional, org.hibernate.validator.internal.util.CollectionHelper, .Contracts, .StringHelper, org.hibernate.validator.internal.util.logging.Log, .LoggerFactory, org.hibernate.validator.spi.properties.ConstrainableExecutable, .GetterPropertySelectionStrategy

Author
Marko Bekhta

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String[]
private static final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public List<String>
getGetterMethodNameCandidates(String
a property name
propertyName
)

Implements org.hibernate.validator.spi.properties.GetterPropertySelectionStrategy.getGetterMethodNameCandidates.

Gives a set of possible method names based on a property name.
public Optional<String>
getProperty(ConstrainableExecutable executable)

Implements org.hibernate.validator.spi.properties.GetterPropertySelectionStrategy.getProperty.

Returns the property corresponding to the getter if the method is considered a getter.
private static boolean

Returns:

true, if the given executable is a JavaBean getter method, false otherwise.
isGetter
(ConstrainableExecutable
The executable of interest.
executable
)

Checks whether the given executable is a valid JavaBean getter method, which is the case if

  • its name starts with "get" and it has a return type but no parameter or
  • its name starts with "is", it has no parameter and is returning boolean or
  • its name starts with "has", it has no parameter and is returning boolean (HV-specific, not mandated by the JavaBeans spec).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GETTER_PREFIX_GETback to summary
private static final String GETTER_PREFIX_GET
GETTER_PREFIX_HASback to summary
private static final String GETTER_PREFIX_HAS
GETTER_PREFIX_ISback to summary
private static final String GETTER_PREFIX_IS
GETTER_PREFIXESback to summary
private static final String[] GETTER_PREFIXES
LOGback to summary
private static final Log LOG

Constructor Detail

DefaultGetterPropertySelectionStrategyback to summary
public DefaultGetterPropertySelectionStrategy()

Method Detail

getGetterMethodNameCandidatesback to summary
public List<String> getGetterMethodNameCandidates(String propertyName)

Implements org.hibernate.validator.spi.properties.GetterPropertySelectionStrategy.getGetterMethodNameCandidates.

Doc from org.hibernate.validator.spi.properties.GetterPropertySelectionStrategy.getGetterMethodNameCandidates.

Gives a set of possible method names based on a property name. Usually, it means a property name prefixed with something like "get", "is", "has" etc.

Parameters
propertyName:String

a property name

Returns:List<String>

the Set of possible getter names

Annotations
@Override
getPropertyback to summary
public Optional<String> getProperty(ConstrainableExecutable executable)

Implements org.hibernate.validator.spi.properties.GetterPropertySelectionStrategy.getProperty.

Doc from org.hibernate.validator.spi.properties.GetterPropertySelectionStrategy.getProperty.

Returns the property corresponding to the getter if the method is considered a getter.

Parameters
executable:ConstrainableExecutable

a ConstrainableExecutable

Returns:Optional<String>

an optional containing the property corresponding to the given executable if it is considered a getter, or an empty optional otherwise

Annotations
@Override
isGetterback to summary
private static boolean isGetter(ConstrainableExecutable executable)

Checks whether the given executable is a valid JavaBean getter method, which is the case if

  • its name starts with "get" and it has a return type but no parameter or
  • its name starts with "is", it has no parameter and is returning boolean or
  • its name starts with "has", it has no parameter and is returning boolean (HV-specific, not mandated by the JavaBeans spec).
Parameters
executable:ConstrainableExecutable

The executable of interest.

Returns:boolean

true, if the given executable is a JavaBean getter method, false otherwise.