Top Description Fields Constructors Methods
org.hibernate.validator.internal.metadata.raw

public Class ConstrainedExecutable

extends AbstractConstrainedElement
Class Inheritance
Static Imports
org.hibernate.validator.internal.util.CollectionHelper.newArrayList, .CollectionHelper.newHashSet

Represents a method or constructor of a Java type and all its associated meta-data relevant in the context of bean validation, for instance the constraints at its parameters or return value.
Authors
Gunnar Morling, Guillaume Smet

Field Summary

Modifier and TypeField and Description
private final Callable
private final Set<MetaConstraint<?>>
private final boolean
private static final Log
private final List<ConstrainedParameter>
parameterMetaData

Constrained-related meta data for this executable's parameters.

Inherited from org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement:
cascadingMetaDataBuilderconstraintssourcetypeArgumentConstraints

Constructor Summary

AccessConstructor and Description
public
ConstrainedExecutable(ConfigurationSource
The source of meta data.
source
,
Callable
The represented executable.
callable
,
Set<MetaConstraint<?>>
Type arguments constraints, if any.
returnValueConstraints
,
Set<MetaConstraint<?>>
The type argument constraints on the return value of the represented executable, if any.
typeArgumentConstraints
,
CascadingMetaDataBuilder
The cascaded validation metadata for this element and its container elements.
cascadingMetaDataBuilder
)

Creates a new executable meta data object for a parameter-less executable.

public
ConstrainedExecutable(ConfigurationSource
The source of meta data.
source
,
Callable
The represented executable.
callable
,
List<ConstrainedParameter>
A list with parameter meta data. The length must correspond with the number of parameters of the represented executable. So this list may be empty (in case of a parameterless executable), but never null.
parameterMetaData
,
Set<MetaConstraint<?>>
the cross parameter constraints
crossParameterConstraints
,
Set<MetaConstraint<?>>
The return value constraints of the represented executable, if any.
returnValueConstraints
,
Set<MetaConstraint<?>>
The type argument constraints on the return value of the represented executable, if any.
typeArgumentConstraints
,
CascadingMetaDataBuilder
The cascaded validation metadata for this element and its container elements.
cascadingMetaDataBuilder
)

Creates a new executable meta data object.

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement.equals.

Indicates whether some other object is "equal to" this one.
public List<ConstrainedParameter>

Returns:

A list with parameter meta data. The length corresponds to the number of parameters of the executable represented by this meta data object, so an empty list may be returned (in case of a parameterless executable), but never null.
getAllParameterMetaData
()

Returns meta data for all parameters of the represented executable.

public Callable
public Set<MetaConstraint<?>>
private Set<ConstraintDescriptor<?>>
public ConstrainedParameter

Returns:

Meta data for the specified parameter. Will never be null.
getParameterMetaData
(int
The index in this executable's parameter array of the parameter of interest.
parameterIndex
)

Constraint meta data for the specified parameter.

public int
public boolean

Returns:

True, if this executable is parameter-constrained by any means, false otherwise.
hasParameterConstraints
()

Whether this executable has at least one cascaded parameter or at least one parameter with constraints or at least one cross-parameter constraint.

private boolean
public boolean

Returns:

True if this executable is constrained by any means, false otherwise.
isConstrained
()

Overrides org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement.isConstrained.

Implements org.hibernate.validator.internal.metadata.raw.ConstrainedElement.isConstrained.

Whether the represented executable is constrained or not.
public boolean

Returns:

True if this and the other executable have the same parameter constraints (including cross- parameter constraints and parameter cascades), false otherwise.
isEquallyParameterConstrained
(ConstrainedExecutable
The other executable to check.
other
)

Whether this and the given other executable have the same parameter constraints.

public ConstrainedExecutable

Returns:

A merged executable.
merge
(ConstrainedExecutable
The executable to merge.
other
)

Creates a new constrained executable object by merging this and the given other executable.

public String
toString()

Overrides org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement.toString.

Returns a string representation of the object.
Inherited from org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement:
getCascadingMetaDataBuildergetConstraintsgetKindgetSourcegetTypeArgumentConstraintsiterator

Field Detail

callableback to summary
private final Callable callable
crossParameterConstraintsback to summary
private final Set<MetaConstraint<?>> crossParameterConstraints
Annotations
@Immutable
hasParameterConstraintsback to summary
private final boolean hasParameterConstraints
LOGback to summary
private static final Log LOG
parameterMetaDataback to summary
private final List<ConstrainedParameter> parameterMetaData

Constrained-related meta data for this executable's parameters.

Annotations
@Immutable

Constructor Detail

ConstrainedExecutableback to summary
public ConstrainedExecutable(ConfigurationSource source, Callable callable, Set<MetaConstraint<?>> returnValueConstraints, Set<MetaConstraint<?>> typeArgumentConstraints, CascadingMetaDataBuilder cascadingMetaDataBuilder)

Creates a new executable meta data object for a parameter-less executable.

Parameters
source:ConfigurationSource

The source of meta data.

callable:Callable

The represented executable.

returnValueConstraints:Set<MetaConstraint<?>>

Type arguments constraints, if any.

typeArgumentConstraints:Set<MetaConstraint<?>>

The type argument constraints on the return value of the represented executable, if any.

cascadingMetaDataBuilder:CascadingMetaDataBuilder

The cascaded validation metadata for this element and its container elements.

ConstrainedExecutableback to summary
public ConstrainedExecutable(ConfigurationSource source, Callable callable, List<ConstrainedParameter> parameterMetaData, Set<MetaConstraint<?>> crossParameterConstraints, Set<MetaConstraint<?>> returnValueConstraints, Set<MetaConstraint<?>> typeArgumentConstraints, CascadingMetaDataBuilder cascadingMetaDataBuilder)

Creates a new executable meta data object.

Parameters
source:ConfigurationSource

The source of meta data.

callable:Callable

The represented executable.

parameterMetaData:List<ConstrainedParameter>

A list with parameter meta data. The length must correspond with the number of parameters of the represented executable. So this list may be empty (in case of a parameterless executable), but never null.

crossParameterConstraints:Set<MetaConstraint<?>>

the cross parameter constraints

returnValueConstraints:Set<MetaConstraint<?>>

The return value constraints of the represented executable, if any.

typeArgumentConstraints:Set<MetaConstraint<?>>

The type argument constraints on the return value of the represented executable, if any.

cascadingMetaDataBuilder:CascadingMetaDataBuilder

The cascaded validation metadata for this element and its container elements.

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAllParameterMetaDataback to summary
public List<ConstrainedParameter> getAllParameterMetaData()

Returns meta data for all parameters of the represented executable.

Returns:List<ConstrainedParameter>

A list with parameter meta data. The length corresponds to the number of parameters of the executable represented by this meta data object, so an empty list may be returned (in case of a parameterless executable), but never null.

getCallableback to summary
public Callable getCallable()
getCrossParameterConstraintsback to summary
public Set<MetaConstraint<?>> getCrossParameterConstraints()
getDescriptorsback to summary
private Set<ConstraintDescriptor<?>> getDescriptors(Iterable<MetaConstraint<?>> constraints)
getParameterMetaDataback to summary
public ConstrainedParameter getParameterMetaData(int parameterIndex)

Constraint meta data for the specified parameter.

Parameters
parameterIndex:int

The index in this executable's parameter array of the parameter of interest.

Returns:ConstrainedParameter

Meta data for the specified parameter. Will never be null.

Exceptions
IllegalArgumentException:
In case this executable doesn't have a parameter with the specified index.
hashCodeback to summary
public int hashCode()

Overrides org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
hasParameterConstraintsback to summary
public boolean hasParameterConstraints()

Whether this executable has at least one cascaded parameter or at least one parameter with constraints or at least one cross-parameter constraint.

Returns:boolean

True, if this executable is parameter-constrained by any means, false otherwise.

hasParameterConstraintsback to summary
private boolean hasParameterConstraints(List<ConstrainedParameter> parameterMetaData)
isConstrainedback to summary
public boolean isConstrained()

Overrides org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement.isConstrained.

Implements org.hibernate.validator.internal.metadata.raw.ConstrainedElement.isConstrained.

Whether the represented executable is constrained or not. This is the case if it has at least one constrained parameter, at least one parameter marked for cascaded validation, at least one cross-parameter constraint, at least one return value constraint or if the return value is marked for cascaded validation.

Returns:boolean

True if this executable is constrained by any means, false otherwise.

Annotations
@Override
isEquallyParameterConstrainedback to summary
public boolean isEquallyParameterConstrained(ConstrainedExecutable other)

Whether this and the given other executable have the same parameter constraints.

Parameters
other:ConstrainedExecutable

The other executable to check.

Returns:boolean

True if this and the other executable have the same parameter constraints (including cross- parameter constraints and parameter cascades), false otherwise.

mergeback to summary
public ConstrainedExecutable merge(ConstrainedExecutable other)

Creates a new constrained executable object by merging this and the given other executable. Both executables must have the same location, i.e. represent the same executable on the same type.

Parameters
other:ConstrainedExecutable

The executable to merge.

Returns:ConstrainedExecutable

A merged executable.

toStringback to summary
public String toString()

Overrides org.hibernate.validator.internal.metadata.raw.AbstractConstrainedElement.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override