Enum ConditionalHelpers

  • All Implemented Interfaces:
    Helper<java.lang.Object>, java.io.Serializable, java.lang.Comparable<ConditionalHelpers>

    public enum ConditionalHelpers
    extends java.lang.Enum<ConditionalHelpers>
    implements Helper<java.lang.Object>
    Implementation of equals, greater, lessThan, and, or, etc.. operators.
    Since:
    4.0.7
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      and
      And operator.
      eq
      Test if two elements are equals.
      gt
      Greater operator (arguments must be Comparable elements.
      gte
      Greater or equal operator (arguments must be Comparable elements.
      lt
      Less than operator (arguments must be Comparable elements.
      lte
      Less or equal operator (arguments must be Comparable elements.
      neq
      Test if two elements are NOT equals.
      not
      Not operator.
      or
      Or operator.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ConditionalHelpers valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static ConditionalHelpers[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface com.github.jknack.handlebars.Helper

        apply
    • Enum Constant Detail

      • eq

        public static final ConditionalHelpers eq
        Test if two elements are equals. Usage: Render 'yes' or 'no':
           {{#eq a b}}
             yes
           {{else}}
             no
           {{/eq}}
         
        Render 'true' or 'false':
           {{eq a b}}
         
        Render 'y' or 'n':
           {{eq a b yes='y' no='n'}}
         
      • neq

        public static final ConditionalHelpers neq
        Test if two elements are NOT equals. Usage: Render 'yes' or 'no':
           {{#neq a b}}
             yes
           {{else}}
             no
           {{/neq}}
         
        Render 'true' or 'false':
           {{neq a b}}
         
        Render 'y' or 'n':
           {{neq a b yes='y' no='n'}}
         
      • gt

        public static final ConditionalHelpers gt
        Greater operator (arguments must be Comparable elements. Usage: Render 'yes' or 'no':
           {{#gt a b}}
             yes
           {{else}}
             no
           {{/gt}}
         
        Render 'true' or 'false':
           {{gt a b}}
         
        Render 'y' or 'n':
           {{neq a b yes='y' no='n'}}
         
      • gte

        public static final ConditionalHelpers gte
        Greater or equal operator (arguments must be Comparable elements. Usage: Render 'yes' or 'no':
           {{#gte a b}}
             yes
           {{else}}
             no
           {{/gte}}
         
        Render 'true' or 'false':
           {{gte a b}}
         
        Render 'y' or 'n':
           {{gte a b yes='y' no='n'}}
         
      • lt

        public static final ConditionalHelpers lt
        Less than operator (arguments must be Comparable elements. Usage: Render 'yes' or 'no':
           {{#lt a b}}
             yes
           {{else}}
             no
           {{/lt}}
         
        Render 'true' or 'false':
           {{lt a b}}
         
        Render 'y' or 'n':
           {{lt a b yes='y' no='n'}}
         
      • lte

        public static final ConditionalHelpers lte
        Less or equal operator (arguments must be Comparable elements. Usage: Render 'yes' or 'no':
           {{#lte a b}}
             yes
           {{else}}
             no
           {{/lte}}
         
        Render 'true' or 'false':
           {{lte a b}}
         
        Render 'y' or 'n':
           {{lte a b yes='y' no='n'}}
         
      • and

        public static final ConditionalHelpers and
        And operator. Truthiness of arguments is determined by Handlebars.Utils.isEmpty(Object), so this helper can be used with non-boolean values. Usage: Render 'yes' or 'no':
           {{#and a b}}
             yes
           {{else}}
             no
           {{/and}}
         
        Multiple arguments are supported too:
           {{#and a b c d}}
             yes
           {{else}}
             no
           {{/and}}
         
        Render 'true' or 'false':
           {{and a b}}
         
        Render 'y' or 'n':
           {{and a b yes='y' no='n'}}
         
      • or

        public static final ConditionalHelpers or
        Or operator. Truthiness of arguments is determined by Handlebars.Utils.isEmpty(Object), so this helper can be used with non-boolean values. Usage: Render 'yes' or 'no':
           {{#or a b}}
             yes
           {{else}}
             no
           {{/or}}
         
        Multiple arguments are supported too:
           {{#or a b c d}}
             yes
           {{else}}
             no
           {{/or}}
         
        Render 'true' or 'false':
           {{or a b}}
         
        Render 'y' or 'n':
           {{or a b yes='y' no='n'}}
         
      • not

        public static final ConditionalHelpers not
        Not operator. Truthiness of arguments is determined by Handlebars.Utils.isEmpty(Object), so this helper can be used with non-boolean values. Usage: Render 'yes' or 'no':
           {{#not a}}
             yes
           {{else}}
             no
           {{/not}}
         
        Render 'true' or 'false':
           {{not a}}
         
        Render 'y' or 'n':
           {{not a yes='y' no='n'}}
         
    • Method Detail

      • values

        public static ConditionalHelpers[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ConditionalHelpers c : ConditionalHelpers.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ConditionalHelpers valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null