org.apache.openjpa.jdbc.kernel.exps
Class FilterValueImpl

java.lang.Object
  extended by org.apache.openjpa.jdbc.kernel.exps.FilterValueImpl
All Implemented Interfaces:
FilterValue

 class FilterValueImpl
extends Object
implements FilterValue

Implementation of FilterValue that wraps a Val.

Author:
Abe White

Constructor Summary
FilterValueImpl(Select sel, ExpContext ctx, ExpState state, Val val)
           
 
Method Summary
 void appendTo(SQLBuffer buf)
          Append the first SQL element for this value to the given buffer.
 void appendTo(SQLBuffer buf, int index)
          Append the indexth SQL element for this value to the given buffer.
 ClassMapping getClassMapping()
          If this is a path to a persistent object, return its class mapping, else return null.
 String getColumnAlias(Column col)
          Return the alias to use for the given column (this includes the table alias prefix, if any).
 String getColumnAlias(String col, Table table)
          Return the alias to use for the given column (this includes the table alias prefix, if any).
 FieldMapping getFieldMapping()
          If this is a path to a persistent field, return its mapping, else return null.
 Object getSQLValue()
          If this is a constant, returns its value as it would be represented in the database in this context, else return null.
 Class getType()
          Return the expected type of this value.
 Object getValue()
          If this is a constant, return its value, else return null.
 XMLMetaData getXmlMapping()
          If this is an XPath, return XML mapping metadata, else return null;
 PCPath getXPath()
          If this is an XPath, return it, else return null;
 boolean isConstant()
          Return true if this value represents a literal or parameter.
 boolean isPath()
          Return true if this value represents a persistent field traversal, such as 'this', 'address.street', or 'projectVariable.title'.
 int length()
          Return the number of SQL elements in this value.
 boolean requiresCast()
          return true if CAST is required for this filter value else return false.
 Object toDataStoreValue(Object val)
          Transform the given value into its datastore equivalent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterValueImpl

public FilterValueImpl(Select sel,
                       ExpContext ctx,
                       ExpState state,
                       Val val)
Method Detail

getType

public Class getType()
Description copied from interface: FilterValue
Return the expected type of this value.

Specified by:
getType in interface FilterValue

length

public int length()
Description copied from interface: FilterValue
Return the number of SQL elements in this value. Usually 1.

Specified by:
length in interface FilterValue

appendTo

public void appendTo(SQLBuffer buf)
Description copied from interface: FilterValue
Append the first SQL element for this value to the given buffer.

Specified by:
appendTo in interface FilterValue

appendTo

public void appendTo(SQLBuffer buf,
                     int index)
Description copied from interface: FilterValue
Append the indexth SQL element for this value to the given buffer.

Specified by:
appendTo in interface FilterValue

getColumnAlias

public String getColumnAlias(Column col)
Description copied from interface: FilterValue
Return the alias to use for the given column (this includes the table alias prefix, if any).

Specified by:
getColumnAlias in interface FilterValue

getColumnAlias

public String getColumnAlias(String col,
                             Table table)
Description copied from interface: FilterValue
Return the alias to use for the given column (this includes the table alias prefix, if any).

Specified by:
getColumnAlias in interface FilterValue

toDataStoreValue

public Object toDataStoreValue(Object val)
Description copied from interface: FilterValue
Transform the given value into its datastore equivalent.

Specified by:
toDataStoreValue in interface FilterValue

isConstant

public boolean isConstant()
Description copied from interface: FilterValue
Return true if this value represents a literal or parameter.

Specified by:
isConstant in interface FilterValue

getValue

public Object getValue()
Description copied from interface: FilterValue
If this is a constant, return its value, else return null.

Specified by:
getValue in interface FilterValue

getSQLValue

public Object getSQLValue()
Description copied from interface: FilterValue
If this is a constant, returns its value as it would be represented in the database in this context, else return null.

Specified by:
getSQLValue in interface FilterValue

isPath

public boolean isPath()
Description copied from interface: FilterValue
Return true if this value represents a persistent field traversal, such as 'this', 'address.street', or 'projectVariable.title'.

Specified by:
isPath in interface FilterValue

getClassMapping

public ClassMapping getClassMapping()
Description copied from interface: FilterValue
If this is a path to a persistent object, return its class mapping, else return null.

Specified by:
getClassMapping in interface FilterValue

getFieldMapping

public FieldMapping getFieldMapping()
Description copied from interface: FilterValue
If this is a path to a persistent field, return its mapping, else return null.

Specified by:
getFieldMapping in interface FilterValue

getXPath

public PCPath getXPath()
Description copied from interface: FilterValue
If this is an XPath, return it, else return null;

Specified by:
getXPath in interface FilterValue

getXmlMapping

public XMLMetaData getXmlMapping()
Description copied from interface: FilterValue
If this is an XPath, return XML mapping metadata, else return null;

Specified by:
getXmlMapping in interface FilterValue

requiresCast

public boolean requiresCast()
Description copied from interface: FilterValue
return true if CAST is required for this filter value else return false.

Specified by:
requiresCast in interface FilterValue


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.