public class CommandParameter
extends java.lang.Object
implements java.io.Serializable
Examples:
{name}{=}{value}
{name}{=}{value} AND {expr1=value1} AND {expr2=value2}
{name}{=}{expr1~value1},{expr2~value2}
Constructor and Description |
---|
CommandParameter(java.lang.String name) |
CommandParameter(java.lang.String name,
java.lang.String operator,
Expression... expressions)
Instantiates a parameter with one or more expressions
|
CommandParameter(java.lang.String name,
java.lang.String operator,
int value)
Instantiates a parameter with a numeric value
|
CommandParameter(java.lang.String name,
java.lang.String operator,
java.lang.String value)
Instantiates a parameter with a simple value
|
CommandParameter(java.lang.String name,
java.lang.String operator,
java.lang.String value,
Expression... expressions)
Instantiates a parameter with a simple value and one or more expressions
|
Modifier and Type | Method and Description |
---|---|
void |
addExpression(Expression expression)
Adds an expression to the end of the list of current expressions (if any)
|
CommandParameter |
copy()
Clones the CommandParameter
|
boolean |
equals(java.lang.Object otherParameter) |
java.lang.String |
getEncodedQueryString()
Returns a URL encoded string of this parameter with name, operator, simple value and/or expressions
|
java.util.List<Expression> |
getExpressions()
Returns a list of all current expressions
|
java.util.List<Expression> |
getExpressions(java.lang.String... expressionFields)
Returns expressions selected by their left-hand keys - as in 'expressionField=value'.
|
java.lang.String |
getName()
Returns the name (left of operator) of this parameter
|
java.lang.String |
getSimpleValue()
Returns the simple parameter value or null if no simple value was set for this parameter
|
java.lang.String |
getValueWithExpressions()
Returns the simple parameter value and/or any expressions, separated by 'AND'
|
boolean |
hasExpressions()
Returns true if this parameter has expressions (complex values)
|
boolean |
hasExpressions(java.lang.String expressionField)
Returns true if this parameter has expressions of the given type,
that is, expressions where the left-of-operator key equals 'expressionField'
|
int |
hashCode() |
boolean |
hasOperator() |
boolean |
hasValue()
Returns true if this parameter has a simple value
|
void |
removeExpression(Expression expression)
Removes a single expression identified by all its characteristics
|
void |
removeExpressions(java.lang.String... expressionFields)
Removes expressions selected by their left-of-operator fields/keys - as in 'expressionField=value'.
|
void |
removeExpressionsAfter(Expression expression,
java.lang.String... expressionFields)
Removes all expressions that appear after the provided expression and that
have the given keys to the left of their operators - as in 'expressionField=value'.
|
java.lang.String |
toString() |
public CommandParameter(java.lang.String name)
public CommandParameter(java.lang.String name, java.lang.String operator, java.lang.String value, Expression... expressions)
name
- operator
- value
- expressions
- public CommandParameter(java.lang.String name, java.lang.String operator, Expression... expressions)
name
- operator
- expressions
- public CommandParameter(java.lang.String name, java.lang.String operator, java.lang.String value)
name
- operator
- value
- public CommandParameter(java.lang.String name, java.lang.String operator, int value)
name
- operator
- value
- public java.lang.String getName()
public java.util.List<Expression> getExpressions()
public java.util.List<Expression> getExpressions(java.lang.String... expressionFields)
If the parameter has expressions expr1=x,expr2=y,expr3=z,expr1=u then invoking this method with {"expr1","expr3"} would return expr1=x,expr3=z,expr1=u but not expr2=y.
expressionFields
- The expression types to returnpublic void addExpression(Expression expression)
expression
- to addpublic void removeExpression(Expression expression)
expression
- to removepublic void removeExpressionsAfter(Expression expression, java.lang.String... expressionFields)
This method is intended for bread crumb-like UI controls
expression
- The expression to use a starting point for removal (not inclusive)expressionFields
- The expression fields to removepublic void removeExpressions(java.lang.String... expressionFields)
If the parameter has expressions expr1=x,expr2=y,expr3=z,expr1=u then invoking this method with {"expr1","expr3"} would remove expr1=x,expr3=z and expr1=u but leave expr2=y.
expressionFields
- The expression types (by field) to removepublic boolean hasOperator()
public boolean hasValue()
public boolean hasExpressions()
public boolean hasExpressions(java.lang.String expressionField)
expressionField
- the type of expression to look forpublic java.lang.String getEncodedQueryString()
public java.lang.String getSimpleValue()
public java.lang.String getValueWithExpressions()
public boolean equals(java.lang.Object otherParameter)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public CommandParameter copy()