org.eigenbase.sql2rel
Class ReflectiveConvertletTable

java.lang.Object
  extended by org.eigenbase.sql2rel.ReflectiveConvertletTable
All Implemented Interfaces:
SqlRexConvertletTable
Direct Known Subclasses:
StandardConvertletTable

public class ReflectiveConvertletTable
extends Object
implements SqlRexConvertletTable

Implementation of SqlRexConvertletTable which uses reflection to call any method of the form public RexNode convertXxx(ConvertletContext, SqlNode) or public RexNode convertXxx(ConvertletContext, SqlOperator, SqlCall).

Since:
2005/8/3
Version:
$Id: //open/dev/farrago/src/org/eigenbase/sql2rel/ReflectiveConvertletTable.java#8 $
Author:
jhyde

Field Summary
private  Map<Object,Object> map
           
 
Constructor Summary
ReflectiveConvertletTable()
           
 
Method Summary
protected  void addAlias(SqlOperator alias, SqlOperator target)
          Registers that one operator is an alias for another.
 SqlRexConvertlet get(SqlCall call)
          Returns the convertlet applicable to a given expression.
private  void registerNodeTypeMethod(Method method)
          Registers method if it: a.
protected  void registerOp(SqlOperator op, SqlRexConvertlet convertlet)
          Registers a convertlet for a given operator instance
private  void registerOpTypeMethod(Method method)
          Registers method if it: a.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

private final Map<Object,Object> map
Constructor Detail

ReflectiveConvertletTable

public ReflectiveConvertletTable()
Method Detail

registerNodeTypeMethod

private void registerNodeTypeMethod(Method method)
Registers method if it: a. is public, and b. is named "convertXxx", and c. has a return type of "RexNode" or a subtype d. has a 2 parameters with types ConvertletContext and SqlNode (or a subtype) respectively.


registerOpTypeMethod

private void registerOpTypeMethod(Method method)
Registers method if it: a. is public, and b. is named "convertXxx", and c. has a return type of "RexNode" or a subtype d. has a 3 parameters with types: ConvertletContext; SqlOperator (or a subtype), SqlCall (or a subtype).


get

public SqlRexConvertlet get(SqlCall call)
Description copied from interface: SqlRexConvertletTable
Returns the convertlet applicable to a given expression.

Specified by:
get in interface SqlRexConvertletTable

registerOp

protected void registerOp(SqlOperator op,
                          SqlRexConvertlet convertlet)
Registers a convertlet for a given operator instance

Parameters:
op - Operator instance, say SqlStdOperatorTable.minusOperator
convertlet - Convertlet

addAlias

protected void addAlias(SqlOperator alias,
                        SqlOperator target)
Registers that one operator is an alias for another.

Parameters:
alias - Operator which is alias
target - Operator to translate calls to