Class Conditions

java.lang.Object
org.ocpsoft.rewrite.config.Conditions

public final class Conditions extends Object
Utility for creating and wrapping Condition instances.
Author:
Lincoln Baxter, III
  • Field Details

    • NEGATION_COUNT_KEY

      public static final String NEGATION_COUNT_KEY
  • Constructor Details

    • Conditions

      public Conditions()
  • Method Details

    • isNegated

      public static boolean isNegated(EvaluationContext context)
      Indicates whether the current Condition is being negated.
    • getNegationCount

      public static int getNegationCount(EvaluationContext context)
      Returns the number of "Not"s that have been evaluated in the current evaluation process. For example, when(Not.any(MyCondition)) would have a "NotCount" of "1" during the evaluation of "MyCondition". when(Not.any(Not.any(MyCondition))) would have a "NotCount" of "2" during the evaluation of "MyCondition". This is useful for conditions that may have side effects, as they will know whether or not their condition is being negated.
    • create

      public static ConditionBuilder create()
      Return a new DefaultConditionBuilder that evaluates to True when #evaluate(Rewrite, EvaluationContext) is invoked.
    • wrap

      public static ConditionBuilder wrap(Condition condition)
      Wrap a given Condition as a new DefaultConditionBuilder that evaluates the the original Condition when #evaluate(Rewrite, EvaluationContext) is invoked.