Class Handlebars.Utils

java.lang.Object
com.github.jknack.handlebars.Handlebars.Utils
Enclosing class:
Handlebars

@Deprecated(since="2024-07-10") public static class Handlebars.Utils extends Object
Deprecated.
com.github.jknack.handlebars package is deprecated and marked for removal in subsequent releases which will involve removal of the handlebars dependency in AEM.
Utilities function like: escapeExpression(CharSequence) and isEmpty(Object).
Since:
0.1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Deprecated.
    Current Java version: 8, 11, 15, etc.
    static final boolean
    Deprecated.
    True when running on Java 14 or higher.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    Escapes the characters in a String using HTML entities.
    static boolean
    isEmpty(Object value)
    Deprecated.
    Evaluate the given object and return true is the object is considered empty.
    Deprecated.
    Throws any throwable 'sneakily' - you don't need to catch it, nor declare that you throw it onwards.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • javaVersion

      public static final int javaVersion
      Deprecated.
      Current Java version: 8, 11, 15, etc.
    • javaVersion14

      public static final boolean javaVersion14
      Deprecated.
      True when running on Java 14 or higher.
  • Constructor Details

    • Utils

      public Utils()
      Deprecated.
  • Method Details

    • isEmpty

      public static boolean isEmpty(Object value)
      Deprecated.
      Evaluate the given object and return true is the object is considered empty. Nulls, empty list or array and false values are considered empty.
      Parameters:
      value - The object value.
      Returns:
      Return true is the object is considered empty. Nulls, empty list or array and false values are considered empty.
    • escapeExpression

      public static CharSequence escapeExpression(CharSequence input)
      Deprecated.

      Escapes the characters in a String using HTML entities.

      For example:

      "bread" & "butter"

      becomes:
        "bread" & "butter"
       
      Parameters:
      input - the String to escape, may be null.
      Returns:
      The escaped version of the input or the same input if it's a SafeString.
    • propagate

      public static RuntimeException propagate(Throwable x)
      Deprecated.
      Throws any throwable 'sneakily' - you don't need to catch it, nor declare that you throw it onwards. The exception is still thrown - javac will just stop whining about it.

      Example usage:

      public void run() {
           throw sneakyThrow(new IOException("You don't need to catch me!"));
       }

      NB: The exception is not wrapped, ignored, swallowed, or redefined. The JVM actually does not know or care about the concept of a 'checked exception'. All this method does is hide the act of throwing a checked exception from the java compiler.

      Note that this method has a return type of RuntimeException; it is advised you always call this method as argument to the throw statement to avoid compiler errors regarding no return statement and similar problems. This method won't of course return an actual RuntimeException - it never returns, it always throws the provided exception.

      Parameters:
      x - The throwable to throw without requiring you to catch its type.
      Returns:
      A dummy RuntimeException; this method never returns normally, it always throws an exception!