Module dev.metaschema.core
Interface IConfigurableMessageConstraint
- All Superinterfaces:
IAttributable,IConstraint,IDescribable
- All Known Subinterfaces:
ICardinalityConstraint,IExpectConstraint,IIndexConstraint,IIndexHasKeyConstraint,IKeyConstraint,IMatchesConstraint,IReportConstraint,IUniqueConstraint
Represents a constraint that allows a configurable message.
- Since:
- 2.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.metaschema.core.model.IAttributable
IAttributable.KeyNested classes/interfaces inherited from interface dev.metaschema.core.model.constraint.IConstraint
IConstraint.Level, IConstraint.Type -
Field Summary
Fields inherited from interface dev.metaschema.core.model.IAttributable
DEFAULT_PROPERY_NAMESPACE -
Method Summary
Modifier and TypeMethodDescriptiongenerateMessage(INodeItem item, DynamicContext context) Generate a violation message using the provided item and dynamic context for inline Metapath value insertion.A message to emit when the constraint is violated.Methods inherited from interface dev.metaschema.core.model.IAttributable
getProperties, getPropertyValues, hasProperty, hasPropertyValueMethods inherited from interface dev.metaschema.core.model.constraint.IConstraint
accept, getId, getLevel, getRemarks, getSource, getTarget, getType, matchTargetsMethods inherited from interface dev.metaschema.core.model.IDescribable
getDescription, getEffectiveDescription, getEffectiveFormalName, getFormalName
-
Method Details
-
getMessage
A message to emit when the constraint is violated. Allows embedded Metapath expressions using the syntax\{ metapath \}.- Returns:
- the message if defined or
nullotherwise
-
generateMessage
@NonNull String generateMessage(@NonNull INodeItem item, @NonNull DynamicContext context) throws ConstraintValidationException Generate a violation message using the provided item and dynamic context for inline Metapath value insertion.- Parameters:
item- the target Metapath item to use as the focus for Metapath evaluationcontext- the dynamic context for Metapath evaluation- Returns:
- the message
- Throws:
ConstraintInitializationException- if a custom message is not defined, which will occur if this method is called whilegetMessage()returnsnullConstraintValidationException- if the custom message contains a Metapath expression that is invalid or if the expression failed to evaluate
-