com.ibm.websphere.query.base
Class ValueList

java.lang.Object
  extended by com.ibm.websphere.query.base.ValueList
All Implemented Interfaces:
IFunctionElement, ILeftOperand, IRightOperand, IStringBuilder, IValue, java.io.Serializable

public class ValueList
extends java.lang.Object
implements IValue

The ValueList class represents a list of values in the query framework.

This class contains a value string and data type to describe a value in a query. For example, an integer value "30" will be constructed as value string = "30", and data type = Constants.DATATYPE_INTEGER, while a string value "Smith" may be constructed as value string = "Smith", and data type = Constants.DATATYPE_CHAR.

This class also provides the ability to specify a property name if this value is associated with a property. This is useful when the data type cannot be determined by the query builder. In this case, the property name is a hint of what property this value will be matched against.

See Also:
Serialized Form

Constructor Summary
ValueList()
          Creates a new Value instance, default constructor.
ValueList(java.lang.String[] newValueStrings)
          Creates a new Value instance with the given value string.
ValueList(java.lang.String[] newValueStrings, int newDataType)
          Creates a new Value instance with the given value string and data type.
ValueList(java.lang.String[] newValueStrings, int newDataType, java.lang.String newPropertyName)
          Creates a new Value instance with the given value string and property name.
ValueList(java.lang.String[] newValueStrings, java.lang.String newPropertyName)
          Creates a new Value instance with the given value string and property name.
ValueList(ValueList value)
          Creates a new Value instance as a copy of the original value.
 
Method Summary
 java.lang.String buildString(ISelectQueryCallback builder)
          Builds a query string for the value.
 void buildString(ISelectQueryCallback builder, java.lang.StringBuffer sb)
           
 boolean equals(java.lang.Object o)
          Tests for equality with the given object.
 int getDataType()
          Returns the data type.
 java.lang.String getPropertyName()
          Returns the property name
 java.lang.String getValueString()
          Returns the value string.
 int hashCode()
          Computes a hash code for the value.
 void setDataType(int newDataType)
          Sets the data type of the value.
 void setPropertyName(java.lang.String newPropertyName)
          Sets the name of the property this value is associated with.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValueList

public ValueList()
Creates a new Value instance, default constructor.


ValueList

public ValueList(java.lang.String[] newValueStrings)
Creates a new Value instance with the given value string.


ValueList

public ValueList(java.lang.String[] newValueStrings,
                 int newDataType)
Creates a new Value instance with the given value string and data type.


ValueList

public ValueList(java.lang.String[] newValueStrings,
                 java.lang.String newPropertyName)
Creates a new Value instance with the given value string and property name.


ValueList

public ValueList(java.lang.String[] newValueStrings,
                 int newDataType,
                 java.lang.String newPropertyName)
Creates a new Value instance with the given value string and property name.


ValueList

public ValueList(ValueList value)
Creates a new Value instance as a copy of the original value.

Method Detail

buildString

public java.lang.String buildString(ISelectQueryCallback builder)
                             throws QueryException
Builds a query string for the value.

Specified by:
buildString in interface IStringBuilder
Throws:
QueryException

buildString

public void buildString(ISelectQueryCallback builder,
                        java.lang.StringBuffer sb)
                 throws QueryException
Specified by:
buildString in interface IStringBuilder
Throws:
QueryException

equals

public boolean equals(java.lang.Object o)
Tests for equality with the given object.

Overrides:
equals in class java.lang.Object

getDataType

public int getDataType()
Returns the data type.

Specified by:
getDataType in interface IFunctionElement
Specified by:
getDataType in interface ILeftOperand

getValueString

public java.lang.String getValueString()
Returns the value string.

Specified by:
getValueString in interface IValue

getPropertyName

public java.lang.String getPropertyName()
Returns the property name

Specified by:
getPropertyName in interface IValue

hashCode

public int hashCode()
Computes a hash code for the value.

Overrides:
hashCode in class java.lang.Object

setDataType

public void setDataType(int newDataType)
Sets the data type of the value.


setPropertyName

public void setPropertyName(java.lang.String newPropertyName)
Sets the name of the property this value is associated with. It is not required that all query builders designate a property name for each value, though it is recommended if the data type of the value cannot be determined.