Enum ConditionalHelpers

java.lang.Object
java.lang.Enum<ConditionalHelpers>
com.github.jknack.handlebars.helper.ConditionalHelpers
All Implemented Interfaces:
Helper<Object>, Serializable, Comparable<ConditionalHelpers>, java.lang.constant.Constable

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

    • 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 Details

    • values

      public static ConditionalHelpers[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ConditionalHelpers valueOf(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:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null