Class Rule.Builder

  • Enclosing class:
    Rule

    public static final class Rule.Builder
    extends java.lang.Object
    A builder used to create a Rule class.
    • Method Detail

      • error

        public Rule error​(Node error)
      • error

        public Rule error​(java.lang.String error)
      • treeRule

        public Rule treeRule​(Rule... rules)
      • treeRule

        @SafeVarargs
        public final Rule treeRule​(java.util.List<Rule>... rules)
      • description

        public Rule.Builder description​(java.lang.String description)
      • errorOrElse

        public Rule.Builder errorOrElse​(java.lang.String error,
                                        ToCondition... condition)
        If `condition` IS met, return an error. Otherwise, proceed with the rules generated by the returned builder.

        This method returns a new builder that must be used!

        Parameters:
        condition - a coercible Condition
        error - an error description if the condition is not matched
        Returns:
        new builder to attach subsequent rules to
      • validateOrElse

        public Rule.Builder validateOrElse​(java.lang.String error,
                                           ToCondition... condition)
        If `condition` IS NOT met, return an error. Otherwise, proceed with the rules generated by the returned builder.

        This method returns a new builder that must be used!

        Parameters:
        condition - a coercible Condition
        error - an error description if the condition is not matched
        Returns:
        new builder to attach subsequent rules to