@ThreadSafe public final class Expression extends Object
At a minimum, an expression must contain a string that is the expression itself.
Optionally, attribute names can be substituted with tokens using the '#name_token' syntax; also attribute values can be substituted with tokens using the ':value_token' syntax. If tokens are used in the expression then the values or names associated with those tokens must be explicitly added to the expressionValues and expressionNames maps respectively that are also stored on this object.
Example:-
Expression myExpression = Expression.builder()
.expression("#a = :b")
.putExpressionName("#a", "myAttribute")
.putExpressionValue(":b", myAttributeValue)
.build();
Modifier and Type | Class and Description |
---|---|
static class |
Expression.Builder
A builder for
Expression |
Modifier and Type | Method and Description |
---|---|
Expression |
and(Expression expression)
Coalesces two complete expressions into a single expression joined by an 'AND'.
|
static Expression.Builder |
builder()
Constructs a new expression builder.
|
boolean |
equals(Object o) |
String |
expression() |
Map<String,String> |
expressionNames() |
Map<String,AttributeValue> |
expressionValues() |
int |
hashCode() |
static Expression |
join(Expression expression1,
Expression expression2,
String joinToken)
Coalesces two complete expressions into a single expression.
|
static String |
joinExpressions(String expression1,
String expression2,
String joinToken)
Coalesces two expression strings into a single expression string.
|
static Map<String,String> |
joinNames(Map<String,String> expressionNames1,
Map<String,String> expressionNames2)
Coalesces two ExpressionNames maps into a single ExpressionNames map.
|
static Map<String,AttributeValue> |
joinValues(Map<String,AttributeValue> expressionValues1,
Map<String,AttributeValue> expressionValues2)
Coalesces two ExpressionValues maps into a single ExpressionValues map.
|
public static Expression.Builder builder()
public static Expression join(Expression expression1, Expression expression2, String joinToken)
expression1
- The first expression to coalesceexpression2
- The second expression to coalescejoinToken
- The join token to be used to join the expression strings (e.g.: 'AND', 'OR')IllegalArgumentException
- if a conflict occurs when merging ExpressionNames or ExpressionValuespublic static String joinExpressions(String expression1, String expression2, String joinToken)
expression1
- The first expression string to coalesceexpression2
- The second expression string to coalescejoinToken
- The join token to be used to join the expression strings (e.g.: 'AND', 'OR)public static Map<String,AttributeValue> joinValues(Map<String,AttributeValue> expressionValues1, Map<String,AttributeValue> expressionValues2)
expressionValues1
- The first ExpressionValues mapexpressionValues2
- The second ExpressionValues mapIllegalArgumentException
- if a conflict occurs when merging ExpressionValuespublic static Map<String,String> joinNames(Map<String,String> expressionNames1, Map<String,String> expressionNames2)
expressionNames1
- The first ExpressionNames mapexpressionNames2
- The second ExpressionNames mapIllegalArgumentException
- if a conflict occurs when merging ExpressionNamespublic String expression()
public Map<String,AttributeValue> expressionValues()
public Expression and(Expression expression)
join(Expression, Expression, String)
Copyright © 2023. All rights reserved.