Interface IReportConstraint

All Superinterfaces:
IAttributable, IConfigurableMessageConstraint, IConstraint, IDescribable

public interface IReportConstraint extends IConfigurableMessageConstraint
Represents a rule reporting a condition when a Metaschema assembly, field, or flag data instance matches a Metapath-based test.

Unlike IExpectConstraint which generates a finding when the test is FALSE, a report constraint generates a finding when the test is TRUE. This is useful for:

  • Reporting deprecated usage patterns
  • Flagging known issues or limitations
  • Providing informational messages about content

A custom message can be used to indicate what a matching condition signifies. The default severity level is IConstraint.Level.INFORMATIONAL.

Since:
2.0.0
  • Field Details

    • DEFAULT_LEVEL

      @NonNull static final IConstraint.Level DEFAULT_LEVEL
      The default severity level for report constraints.
  • Method Details

    • getType

      default IConstraint.Type getType()
      Description copied from interface: IConstraint
      Get the constraint type.
      Specified by:
      getType in interface IConstraint
      Returns:
      the constraint type
    • getTest

      @NonNull IMetapathExpression getTest()
      Get the test to use to identify reportable conditions in selected nodes.

      A finding is generated when this test evaluates to true.

      Returns:
      the test metapath expression to use
    • accept

      default <T, R> R accept(IConstraintVisitor<T,R> visitor, T state)
      Description copied from interface: IConstraint
      Used for double dispatch supporting the visitor pattern provided by implementations of IConstraintVisitor.
      Specified by:
      accept in interface IConstraint
      Type Parameters:
      T - the Java type of a state object passed to the visitor
      R - the Java type of the result returned by the visitor methods
      Parameters:
      visitor - the visitor implementation
      state - the state object passed to the visitor
      Returns:
      the visitation result
      See Also:
    • builder

      @NonNull static IReportConstraint.Builder builder()
      Create a new constraint builder.
      Returns:
      the builder