com.indexdata.mkjsf.pazpar2.commands
Class Expression

java.lang.Object
  extended by com.indexdata.mkjsf.pazpar2.commands.Expression
All Implemented Interfaces:
Serializable

public class Expression
extends Object
implements Serializable

Represents a complex command parameter value, in form of an expression with an equality operator

An expression consist of a left-of-operator field or key, an equality operator (= or ~), a right-of-operator value, and optionally a label describing the value for UI display.

Examples:

Author:
Niels Erik
See Also:
Serialized Form

Constructor Summary
Expression(String expressionString)
          Instantiates an expression by parsing the provided expression string, which must be on the form {name}({=}or{~}){value}.
Expression(String field, String operator, String value, String label)
          Instantiates an expression with a label
 
Method Summary
 Expression copy()
          Clones the expression
 String getField()
          Returns the left-of-operator field (or name or key).
 String getLabel()
          Returns the label describing the value of the expression or, if no label was provided, the value itself.
 String getOperator()
          Returns the operator
 String getValue()
          Returns the right-of-operator value of the expression
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Expression

public Expression(String field,
                  String operator,
                  String value,
                  String label)
Instantiates an expression with a label

Parameters:
leftEntity - left-of-operator field name (or 'key')
operator - an equality operator
rightEntity - right-of-operator value
label - to be used for display, for instance in a UI control that adds or removes the expression from a command parameter

Expression

public Expression(String expressionString)
Instantiates an expression by parsing the provided expression string, which must be on the form {name}({=}or{~}){value}.

Currently only '=' and '~' are recognized as operators

Parameters:
expressionString -
Method Detail

copy

public Expression copy()
Clones the expression

Returns:
a clone of this expression

toString

public String toString()
Overrides:
toString in class Object

getLabel

public String getLabel()
Returns the label describing the value of the expression or, if no label was provided, the value itself.

Returns:
label or right-of-operator value if no label provided

getField

public String getField()
Returns the left-of-operator field (or name or key).

Returns:
entity left of operator

getOperator

public String getOperator()
Returns the operator

Returns:
the operator of the expression

getValue

public String getValue()
Returns the right-of-operator value of the expression

Returns:
entity right of operator


Copyright © 2013. All Rights Reserved.