T
- type of value that can be heldpublic final class ValueOrExpression<T> extends Object
Token(s) in an expression must use the pattern:
&{some.token}Example: a
ValueOrExpression<Integer>
could contain either the integer value 4444 or
the expression "&{port}".Modifier and Type | Field and Description |
---|---|
static String |
TOKEN_END
The marker of end for a commons-config token.
|
static String |
TOKEN_START
The marker of start for a commons-config token.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getExpression()
Returns the expression if any.
|
T |
getValue()
Returns the value if any.
|
T |
getValueOrThrowIfExpression()
Returns the value or throws if no value is available.
|
int |
hashCode() |
boolean |
isExpression()
Indicates if this wraps an expression.
|
static <T> ValueOrExpression<T> |
newExpression(String expression)
Creates an expression.
|
static ValueOrExpression<String> |
newFileExpression(String filePath)
Creates an expression corresponding to a file path.
|
static <T> ValueOrExpression<T> |
newValue(T value)
Creates a value.
|
static <T> ValueOrExpression<T> |
newValueOrNull(T value)
Creates a new ValueOrExpression that wraps the provided value if the value is not
null . |
String |
toString() |
public static final String TOKEN_START
public static final String TOKEN_END
public static <T> ValueOrExpression<T> newExpression(String expression)
T
- type of valueexpression
- The expressionNullPointerException
- if provided expression is nullpublic static ValueOrExpression<String> newFileExpression(String filePath)
filePath
- The file path to use in the expressionpublic static <T> ValueOrExpression<T> newValue(T value)
T
- type of valuevalue
- The actual valueNullPointerException
- if provided value is nullpublic static <T> ValueOrExpression<T> newValueOrNull(T value)
null
.T
- type of valuevalue
- The value which may be null
null
if a null
value is providedpublic String getExpression()
null
if there is no expressionpublic T getValue()
null
if there is no valuepublic T getValueOrThrowIfExpression() throws ExpressionException
null
ExpressionException
- if this expression does not contain a valuepublic boolean isExpression()
true
if this is an expression, or false
if it is a valueCopyright 2010-2018 ForgeRock AS.