Class ValueOrExpression<T>
java.lang.Object
org.forgerock.opendj.config.ValueOrExpression<T>
- Type Parameters:
T- type of value that can be held
Wraps either a value of a given type or an expression string containing at least one token.
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}".-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsExpression(String expression) Validates the expression, checking it has at least one token.booleanReturns the wrapped expression, ornullif there is no expression.getValue()Returns the wrapped value ornullif there is no value.Returns the nevernullwrapped value, or throws if no value is available.inthashCode()booleanReturnstrueif this wraps an expression, orfalseif it is a value.static <T> ValueOrExpression<T> newExpression(String expression) Returns a wrapper for an expression.static ValueOrExpression<String> newFileExpression(String filePath) Returns a wrapper for an expression corresponding to a file path.static <T> ValueOrExpression<T> newValue(T value) Returns a wrapper for a value.static <T> ValueOrExpression<T> newValueOrNull(T value) Returns a wrapper for a value, ornullif anullvalue is provided.toString()
-
Field Details
-
TOKEN_START
-
TOKEN_END
-
-
Method Details
-
newExpression
Returns a wrapper for an expression.- Type Parameters:
T- type of value- Parameters:
expression- The expression- Returns:
- a wrapper for an expression
- Throws:
NullPointerException- if provided expression is null
-
newFileExpression
Returns a wrapper for an expression corresponding to a file path.- Parameters:
filePath- The file path to use in the expression- Returns:
- a wrapper for an expression corresponding to a file path
-
newValue
Returns a wrapper for a value.- Type Parameters:
T- type of value- Parameters:
value- The actual value- Returns:
- a wrapper for a value
- Throws:
NullPointerException- if provided value is null
-
newValueOrNull
Returns a wrapper for a value, ornullif anullvalue is provided.- Type Parameters:
T- type of value- Parameters:
value- The value which may benull- Returns:
- a wrapper for a value, or
nullif anullvalue is provided
-
containsExpression
Validates the expression, checking it has at least one token.- Parameters:
expression- The expression to validate- Returns:
trueif the expression is valid,falseotherwise
-
getExpression
Returns the wrapped expression, ornullif there is no expression.- Returns:
- the wrapped expression, or
nullif there is no expression
-
getValue
Returns the wrapped value ornullif there is no value.- Returns:
- the wrapped value or
nullif there is no value
-
getValueOrThrowIfExpression
Returns the nevernullwrapped value, or throws if no value is available.- Returns:
- the never
nullwrapped value, or throws if no value is available - Throws:
ExpressionException- if this expression does not contain a value
-
isExpression
public boolean isExpression()Returnstrueif this wraps an expression, orfalseif it is a value.- Returns:
trueif this wraps an expression, orfalseif it is a value
-
equals
-
hashCode
-
toString
-