public static class Handlebars.Utils
extends java.lang.Object
escapeExpression(CharSequence)
and
isEmpty(Object)
.Modifier and Type | Field and Description |
---|---|
static int |
javaVersion
Current Java version: 8, 11, 15, etc.
|
static boolean |
javaVersion14
True when running on Java 14 or higher.
|
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.CharSequence |
escapeExpression(java.lang.CharSequence input)
Escapes the characters in a
String using HTML entities. |
static boolean |
isEmpty(java.lang.Object value)
Evaluate the given object and return true is the object is considered
empty.
|
static java.lang.RuntimeException |
propagate(java.lang.Throwable x)
Throws any throwable 'sneakily' - you don't need to catch it, nor declare that you throw it
onwards.
|
public static final int javaVersion
public static final boolean javaVersion14
public static boolean isEmpty(java.lang.Object value)
value
- The object value.public static java.lang.CharSequence escapeExpression(java.lang.CharSequence input)
Escapes the characters in a String
using HTML entities.
For example:
"bread" & "butter"
"bread" & "butter"
input
- the String
to escape, may be null.public static java.lang.RuntimeException propagate(java.lang.Throwable x)
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.
x
- The throwable to throw without requiring you to catch its type.Copyright © 2010 - 2023 Adobe. All Rights Reserved