Top Description Inners Methods
javax.validation.metadata

public Interface ElementDescriptor

Known Direct Subinterfaces
javax.validation.metadata.ExecutableDescriptor, javax.validation.metadata.ParameterDescriptor, javax.validation.metadata.PropertyDescriptor, javax.validation.metadata.ReturnValueDescriptor, javax.validation.metadata.BeanDescriptor, javax.validation.metadata.ContainerElementTypeDescriptor, javax.validation.metadata.CrossParameterDescriptor
Imports
javax.validation.groups.Default, java.lang.annotation.ElementType, java.util.Set

Describes a validated element (class, property, method etc.).
Authors
Emmanuel Bernard, Hardy Ferentschik, Gunnar Morling

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ElementDescriptor.ConstraintFinder

Declares restrictions on retrieved constraints.

Method Summary

Modifier and TypeMethod and Description
public ElementDescriptor.ConstraintFinder

Returns:

ConstraintFinder object
findConstraints
()

Finds constraints and potentially restricts them to certain criteria.

public Set<ConstraintDescriptor<?>>

Returns:

Set of constraint descriptors for this element
getConstraintDescriptors
()

Returns all constraint descriptors for this element in the class hierarchy or an empty Set if none are present.

public Class<?>

Returns:

the statically defined returned type
getElementClass
()

public boolean

Returns:

returns true if at least one constraint declaration is present for this element in the class hierarchy, false otherwise
hasConstraints
()

Method Detail

findConstraintsback to summary
public ElementDescriptor.ConstraintFinder findConstraints()

Finds constraints and potentially restricts them to certain criteria.

Returns:ElementDescriptor.ConstraintFinder

ConstraintFinder object

getConstraintDescriptorsback to summary
public Set<ConstraintDescriptor<?>> getConstraintDescriptors()

Returns all constraint descriptors for this element in the class hierarchy or an empty Set if none are present.

Returns:Set<ConstraintDescriptor<?>>

Set of constraint descriptors for this element

getElementClassback to summary
public Class<?> getElementClass()
Returns:Class<?>

the statically defined returned type

hasConstraintsback to summary
public boolean hasConstraints()
Returns:boolean

returns true if at least one constraint declaration is present for this element in the class hierarchy, false otherwise

javax.validation.metadata back to summary

public Interface ElementDescriptor.ConstraintFinder


Declares restrictions on retrieved constraints. Restrictions are cumulative.

A ConstraintFinder is not thread-safe. The set of matching ConstraintDescriptor is.

Method Summary

Modifier and TypeMethod and Description
public ElementDescriptor.ConstraintFinder

Returns:

this following the chaining method pattern
declaredOn
(ElementType...
targeted types
types
)

Restricts to the constraints hosted on the listed types for a given element.

public Set<ConstraintDescriptor<?>>

Returns:

matching constraint descriptors
getConstraintDescriptors
()

Retrieves the constraint descriptors following the defined restrictions and hosted on the element described by ElementDescriptor.

public boolean

Returns:

true if there is at least one constraint
hasConstraints
()

Returns true if at least one constraint declaration matching the restrictions is present on the element, false otherwise.

public ElementDescriptor.ConstraintFinder

Returns:

this following the chaining method pattern
lookingAt
(Scope
expected scope
scope
)

Restricts to the constraints matching the provided scope for this element.

public ElementDescriptor.ConstraintFinder

Returns:

this following the chaining method pattern
unorderedAndMatchingGroups
(Class<?>...
groups targeted
groups
)

Restricts to the constraints matching a given set of groups for this element.

Method Detail

declaredOnback to summary
public ElementDescriptor.ConstraintFinder declaredOn(ElementType... types)

Restricts to the constraints hosted on the listed types for a given element.

Defaults to all possible types of the element.

Typically used to restrict to fields (FIELD) or getters (METHOD).

Parameters
types:ElementType[]

targeted types

Returns:ElementDescriptor.ConstraintFinder

this following the chaining method pattern

getConstraintDescriptorsback to summary
public Set<ConstraintDescriptor<?>> getConstraintDescriptors()

Retrieves the constraint descriptors following the defined restrictions and hosted on the element described by ElementDescriptor.

Returns:Set<ConstraintDescriptor<?>>

matching constraint descriptors

hasConstraintsback to summary
public boolean hasConstraints()

Returns true if at least one constraint declaration matching the restrictions is present on the element, false otherwise.

Returns:boolean

true if there is at least one constraint

lookingAtback to summary
public ElementDescriptor.ConstraintFinder lookingAt(Scope scope)

Restricts to the constraints matching the provided scope for this element. Defaults to Scope#HIERARCHY

Parameters
scope:Scope

expected scope

Returns:ElementDescriptor.ConstraintFinder

this following the chaining method pattern

unorderedAndMatchingGroupsback to summary
public ElementDescriptor.ConstraintFinder unorderedAndMatchingGroups(Class<?>... groups)

Restricts to the constraints matching a given set of groups for this element.

This method respects group conversion, group sequences and group inheritance (including class-level Default group overriding) but does not return ConstraintDescriptors in any particular order. Specifically, ordering of the group sequence is not respected.

Parameters
groups:Class<?>[]

groups targeted

Returns:ElementDescriptor.ConstraintFinder

this following the chaining method pattern