- All Superinterfaces:
IAttributable,IDescribable
- All Known Subinterfaces:
IAllowedValuesConstraint,ICardinalityConstraint,IConfigurableMessageConstraint,IExpectConstraint,IIndexConstraint,IIndexHasKeyConstraint,IKeyConstraint,IMatchesConstraint,IReportConstraint,IUniqueConstraint
Represents a rule constraining the model of a Metaschema assembly, field or
flag. Provides a common interface for all constraint definitions.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe degree to which a constraint violation is significant.static enumThe type of constraint.Nested classes/interfaces inherited from interface dev.metaschema.core.model.IAttributable
IAttributable.Key -
Field Summary
Fields inherited from interface dev.metaschema.core.model.IAttributable
DEFAULT_PROPERY_NAMESPACE -
Method Summary
Modifier and TypeMethodDescription<T,R> R accept(IConstraintVisitor<T, R> visitor, T state) Used for double dispatch supporting the visitor pattern provided by implementations ofIConstraintVisitor.static IConstraint.LevelGet the default level to use if no level is provided.static IMetapathExpressionGet the Metapath to use if no target is provided.static StringgetConstraintIdentity(IConstraint constraint) Get a string that identifies the provided constraint using the most specific information available.getId()Retrieve the unique identifier for the constraint.getLevel()The significance of a violation of this constraint.Retrieve the remarks associated with the constraint.Get information about the source of the constraint.Retrieve the Metapath expression to use to query the targets of the constraint.getType()Get the constraint type.ISequence<? extends IDefinitionNodeItem<?,?>> matchTargets(IDefinitionNodeItem<?, ?> item, DynamicContext dynamicContext) Based on the providedcontextNodeItem, find all nodes matching the target expression.Methods inherited from interface dev.metaschema.core.model.IAttributable
getProperties, getPropertyValues, hasProperty, hasPropertyValueMethods inherited from interface dev.metaschema.core.model.IDescribable
getDescription, getEffectiveDescription, getEffectiveFormalName, getFormalName
-
Method Details
-
defaultLevel
Get the default level to use if no level is provided.- Returns:
- the default level
-
defaultTarget
Get the Metapath to use if no target is provided.- Returns:
- the expression
-
getConstraintIdentity
Get a string that identifies the provided constraint using the most specific information available.- Parameters:
constraint- the constraint to identify- Returns:
- the constraint identification statement
-
getType
Get the constraint type.- Returns:
- the constraint type
-
getId
Retrieve the unique identifier for the constraint.- Returns:
- the identifier or
nullif no identifier is defined
-
getSource
Get information about the source of the constraint.- Returns:
- the source information
-
getLevel
The significance of a violation of this constraint.- Returns:
- the level
-
getTarget
Retrieve the Metapath expression to use to query the targets of the constraint.- Returns:
- a Metapath expression
-
matchTargets
@NonNull ISequence<? extends IDefinitionNodeItem<?,?>> matchTargets(@NonNull IDefinitionNodeItem<?, ?> item, @NonNull DynamicContext dynamicContext) Based on the providedcontextNodeItem, find all nodes matching the target expression.- Parameters:
item- the node item to evaluate the target expression againstdynamicContext- the Metapath evaluation context to use- Returns:
- the matching nodes as a sequence
- Throws:
MetapathException- if an error occurred during evaluation- See Also:
-
getRemarks
MarkupMultiline getRemarks()Retrieve the remarks associated with the constraint.- Returns:
- the remarks or
nullif no remarks are defined
-
accept
Used for double dispatch supporting the visitor pattern provided by implementations ofIConstraintVisitor.- Type Parameters:
T- the Java type of a state object passed to the visitorR- the Java type of the result returned by the visitor methods- Parameters:
visitor- the visitor implementationstate- the state object passed to the visitor- Returns:
- the visitation result
- See Also:
-