org.eclipse.datatools.connectivity.oda.spec
Class ExpressionArguments

java.lang.Object
  extended by org.eclipse.datatools.connectivity.oda.spec.ExpressionArguments

public class ExpressionArguments
extends java.lang.Object

Runtime argument(s) of an expression defined in an ODA query specification.
Their values are used by an ODA driver to evaluate an expression and its variable specified in an ODA query specification. The argument values are normally provided by an ODA consumer application during runtime, such as by collecting user-input values for an expression's arguments.

Since:
3.3 (DTP 1.8)

Constructor Summary
ExpressionArguments()
           
ExpressionArguments(java.lang.Object argValues)
          Constructor.
 
Method Summary
 ExpressionArguments addValue(boolean value)
          A convenient method to append a value in primitive data type.
 ExpressionArguments addValue(double value)
          A convenient method to append a value in primitive data type.
 ExpressionArguments addValue(int value)
          A convenient method to append a value in primitive data type.
 ExpressionArguments addValue(java.lang.Object aValue)
          Appends the specified value to the end of its list of argument values.
 java.lang.Object getValue(int index)
          Returns the value at the specified position of the ordered collection of argument values.
 ValueExpression getValueExpression(int index)
          Returns the value expression that represents the value at the specified position of the ordered collection of argument values.
 java.lang.Object getValues()
          Returns all the argument value(s).
 boolean hasValues()
          Indicates whether this has argument values.
 void setValues(java.lang.Object argValues)
          Sets all the argument value(s).
 java.lang.String toString()
           
 int valueCount()
          Returns the number of values in this argument.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExpressionArguments

public ExpressionArguments(java.lang.Object argValues)
Constructor.

Parameters:
argValues - the argument value(s); may be null if no values, a single value, or an ordered Collection that holds multiple values

ExpressionArguments

public ExpressionArguments()
Method Detail

hasValues

public boolean hasValues()
Indicates whether this has argument values. An empty collection in the values returns false for no values.

Returns:
true if this argument has one or more values; false otherwise

valueCount

public int valueCount()
Returns the number of values in this argument.

Returns:
the number of argument values

getValues

public java.lang.Object getValues()
Returns all the argument value(s).

Returns:
the argument value(s); may be null if no values, a single value, or an ordered Collection that holds multiple values

getValue

public java.lang.Object getValue(int index)
Returns the value at the specified position of the ordered collection of argument values. The value at a position is based on the sequence that a value is added using addValue(Object). If the argument's values are not kept in a List, all the value(s) are returned at the 0 position.

Parameters:
index - 0-based position of the list of argument values
Returns:
the value at the specified position, or null if the index is out of range (index < 0 || index >= size()).
See Also:
getValueExpression(int)

getValueExpression

public ValueExpression getValueExpression(int index)
Returns the value expression that represents the value at the specified position of the ordered collection of argument values.

Parameters:
index - 0-based position of the list of argument values
Returns:
an ValueExpression instance representing the value at the specified position, or null if the index is out of range (index < 0 || index >= size()).
See Also:
getValue(int)

addValue

public ExpressionArguments addValue(java.lang.Object aValue)
Appends the specified value to the end of its list of argument values. It is the responsibility of the caller to ensure compatible type of value object is added to the list. Creates an ordered list, if none already exists, to hold the added value object.

Parameters:
aValue - a value to add; may be null
Returns:
this, containing the added value
Throws:
java.lang.UnsupportedOperationException - if existing values, if any, are not in a List

addValue

public ExpressionArguments addValue(int value)
A convenient method to append a value in primitive data type.

Parameters:
value - an int value
Returns:
this, containing the added value
See Also:
addValue(Object)

addValue

public ExpressionArguments addValue(double value)
A convenient method to append a value in primitive data type.

Parameters:
value - a double value
Returns:
this, containing the added value
See Also:
addValue(Object)

addValue

public ExpressionArguments addValue(boolean value)
A convenient method to append a value in primitive data type.

Parameters:
value - a boolean value
Returns:
this, containing the added value
See Also:
addValue(Object)

setValues

public void setValues(java.lang.Object argValues)
Sets all the argument value(s).

Parameters:
argValues - the argument value(s); may be null if no values, a single value, or an ordered Collection that holds multiple values

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object