net.sf.farrago.ojrex
Class FarragoOJRexReinterpretImplementor

java.lang.Object
  extended by net.sf.farrago.ojrex.FarragoOJRexImplementor
      extended by net.sf.farrago.ojrex.FarragoOJRexReinterpretImplementor
All Implemented Interfaces:
OJRexImplementor

public class FarragoOJRexReinterpretImplementor
extends FarragoOJRexImplementor

An OJRexImplementor for reinterpret casts. Reinterpret casts are important for generated Java code, because while Sql types may share the same primitive types, they may require different wrappers. Currently this class can only handle conversions between Decimals and Bigints.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/ojrex/FarragoOJRexReinterpretImplementor.java#13 $
Author:
John Pham

Constructor Summary
FarragoOJRexReinterpretImplementor()
          Constructs an OJRexReinterpretCastImplementor
 
Method Summary
 boolean canImplement(RexCall call)
          Tests whether it is possible to implement a call.
private  void checkNullability(FarragoRexToOJTranslator translator, RelDataType targetType, RexNode rexValue, Expression javaValue)
          Inserts a null test if a value is nullable, but a target type is not.
 Expression implementFarrago(FarragoRexToOJTranslator translator, RexCall call, Expression[] operands)
          Refined version of OJRexImplementor.implement(org.eigenbase.oj.rex.RexToOJTranslator, org.eigenbase.rex.RexCall, openjava.ptree.Expression[]).
 
Methods inherited from class net.sf.farrago.ojrex.FarragoOJRexImplementor
implement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FarragoOJRexReinterpretImplementor

public FarragoOJRexReinterpretImplementor()
Constructs an OJRexReinterpretCastImplementor

Method Detail

canImplement

public boolean canImplement(RexCall call)
Description copied from interface: OJRexImplementor
Tests whether it is possible to implement a call.

Specified by:
canImplement in interface OJRexImplementor
Overrides:
canImplement in class FarragoOJRexImplementor
Parameters:
call - the call for which translation is being considered
Returns:
whether the call can be implemented

implementFarrago

public Expression implementFarrago(FarragoRexToOJTranslator translator,
                                   RexCall call,
                                   Expression[] operands)
Description copied from class: FarragoOJRexImplementor
Refined version of OJRexImplementor.implement(org.eigenbase.oj.rex.RexToOJTranslator, org.eigenbase.rex.RexCall, openjava.ptree.Expression[]).

Specified by:
implementFarrago in class FarragoOJRexImplementor
Parameters:
translator - provides Farrago-specific translation context
call - the call to be translated
operands - call's operands, which have already been translated independently

checkNullability

private void checkNullability(FarragoRexToOJTranslator translator,
                              RelDataType targetType,
                              RexNode rexValue,
                              Expression javaValue)
Inserts a null test if a value is nullable, but a target type is not.