Interface IConfigurableMessageConstraint

All Superinterfaces:
IAttributable, IConstraint, IDescribable
All Known Subinterfaces:
ICardinalityConstraint, IExpectConstraint, IIndexConstraint, IIndexHasKeyConstraint, IKeyConstraint, IMatchesConstraint, IReportConstraint, IUniqueConstraint

public interface IConfigurableMessageConstraint extends IConstraint
Represents a constraint that allows a configurable message.
Since:
2.0.0
  • Method Details

    • getMessage

      @Nullable String getMessage()
      A message to emit when the constraint is violated. Allows embedded Metapath expressions using the syntax \{ metapath \}.
      Returns:
      the message if defined or null otherwise
    • 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 evaluation
      context - 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 while getMessage() returns null
      ConstraintValidationException - if the custom message contains a Metapath expression that is invalid or if the expression failed to evaluate