Interface ConstrainedElement
-
- All Superinterfaces:
Iterable<MetaConstraint<?>>
- All Known Implementing Classes:
AbstractConstrainedElement,ConstrainedExecutable,ConstrainedField,ConstrainedParameter,ConstrainedType
public interface ConstrainedElement extends Iterable<MetaConstraint<?>>
Represents a (potentially) constrained Java element such as a type, field or method. Such an element has a set ofMetaConstraints and can be marked for a cascaded validation. Furthermore each constrained element has aconfiguration sourcewhich determines its origin.The hierarchy of constrained elements resembles the physical structure of the represented Java types. In particular it doesn't provide the notion of properties and it doesn't aggregate meta data for overridden elements in an inheritance hierarchy.
Identity of implementations is based on the element location and constraint source. That means that for instance in a set there can be two configurations for one and the same Java field created by two different configuration sources (e.g. via annotation and XML) but not two configurations for the same field originating from one configuration source.
Implementations are strictly read-only.
- Author:
- Gunnar Morling
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classConstrainedElement.ConstrainedElementKindThe kind of aConstrainedElement.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CascadingMetaDataBuildergetCascadingMetaDataBuilder()Returns the cascading metadata (e.g.Set<MetaConstraint<?>>getConstraints()Returns a set containing the constraints specified for this constrained element.ConstrainedElement.ConstrainedElementKindgetKind()Returns the kind of this constrained element.ConfigurationSourcegetSource()Returns the configuration source contributing this constrained element.Set<MetaConstraint<?>>getTypeArgumentConstraints()Returns the type argument constraints of this element, if any.booleanisConstrained()Whether this element is constrained or not.-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
getKind
ConstrainedElement.ConstrainedElementKind getKind()
Returns the kind of this constrained element.- Returns:
- The kind of this constrained element.
-
getConstraints
Set<MetaConstraint<?>> getConstraints()
Returns a set containing the constraints specified for this constrained element.- Returns:
- A set with this constrained element's constraints. May be empty,
but never
null.
-
getTypeArgumentConstraints
Set<MetaConstraint<?>> getTypeArgumentConstraints()
Returns the type argument constraints of this element, if any.
-
getCascadingMetaDataBuilder
CascadingMetaDataBuilder getCascadingMetaDataBuilder()
Returns the cascading metadata (e.g.ValidandConvertGroup) for the element and the potential container elements.
-
isConstrained
boolean isConstrained()
Whether this element is constrained or not. This is the case, if this element has at least one constraint or a cascaded validation shall be performed for it.- Returns:
True, if this element is constrained,falseotherwise.
-
getSource
ConfigurationSource getSource()
Returns the configuration source contributing this constrained element.
-
-