com.ibm.websphere.query.base
Class Value

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

public class Value
extends java.lang.Object
implements IValue

The Value class represents a general value 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
Value()
          Creates a new Value instance, default constructor.
Value(IValue value)
          Creates a new Value instance as a copy of the original value.
Value(java.lang.String newValueString)
          Creates a new Value instance with the given value string.
Value(java.lang.String newValueString, int newDataType)
          Creates a new Value instance with the given value string and data type.
Value(java.lang.String newValueString, int newDataType, java.lang.String newPropertyName)
          Creates a new Value instance with the given value string and property name.
Value(java.lang.String newValueString, java.lang.String newPropertyName)
          Creates a new Value instance with the given value string and property name.
 
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.
 void setValueString(java.lang.String newValueString)
          Sets the value string of the value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Value

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


Value

public Value(java.lang.String newValueString)
Creates a new Value instance with the given value string.


Value

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


Value

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


Value

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


Value

public Value(IValue 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.


setValueString

public void setValueString(java.lang.String newValueString)
Sets the value string 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.