Class ConditionFactory


  • public final class ConditionFactory
    extends java.lang.Object
    Factory to generate Conditions.
    Since:
    10837 (Extracted from Condition)
    • Method Detail

      • createKeyValueCondition

        public static Condition createKeyValueCondition​(java.lang.String k,
                                                        java.lang.String v,
                                                        ConditionFactory.Op op,
                                                        Condition.Context context,
                                                        boolean considerValAsKey)
        Create a new condition that checks the key and the value of the object.
        Parameters:
        k - The key.
        v - The reference value
        op - The operation to use when comparing the value
        context - The type of context to use.
        considerValAsKey - whether to consider v as another key and compare the values of key k and key v.
        Returns:
        The new condition.
        Throws:
        MapCSSException - if the arguments are incorrect
      • createRegexpKeyRegexpValueCondition

        public static Condition createRegexpKeyRegexpValueCondition​(java.lang.String k,
                                                                    java.lang.String v,
                                                                    ConditionFactory.Op op)
        Create a condition in which the key and the value need to match a given regexp
        Parameters:
        k - The key regexp
        v - The value regexp
        op - The operation to use when comparing the key and the value.
        Returns:
        The new condition.
      • createKeyCondition

        public static Condition createKeyCondition​(java.lang.String k,
                                                   boolean not,
                                                   ConditionFactory.KeyMatchType matchType,
                                                   Condition.Context context)
        Creates a condition that checks the given key.
        Parameters:
        k - The key to test for
        not - true to invert the match
        matchType - The match type to check for.
        context - The context this rule is found in.
        Returns:
        the new condition.