org.teiid.translator.jdbc
Class ConvertModifier

java.lang.Object
  extended by org.teiid.translator.jdbc.FunctionModifier
      extended by org.teiid.translator.jdbc.ConvertModifier

public class ConvertModifier
extends FunctionModifier

Base class for handling the convert function.

Convert is by far the most complicated pushdown function since it actually represents a matrix of possible functions. Additionally not every source supports the same semantics as our conversions.

Each instance of this class makes a best effort at handling converts for for a given source - compensating for differing string representation, the lack a time type etc.

The choice of conversion logic is as follows:


Nested Class Summary
static class ConvertModifier.FormatModifier
           
 
Field Summary
 
Fields inherited from class org.teiid.translator.jdbc.FunctionModifier
BIGDECIMAL, BIGINTEGER, BLOB, BOOLEAN, BYTE, CHAR, CLOB, DATE, DOUBLE, FLOAT, INTEGER, LONG, NULL, OBJECT, SHORT, STRING, TIME, TIMESTAMP, XML
 
Constructor Summary
ConvertModifier()
           
 
Method Summary
 void addConvert(int sourceType, int targetType, FunctionModifier convert)
           
 void addNumericBooleanConversions()
           
 void addSourceConversion(FunctionModifier convert, int... sourceType)
           
 void addTypeConversion(FunctionModifier convert, int... targetType)
           
 void addTypeMapping(String nativeType, int... targetType)
           
static Function createConvertFunction(LanguageFactory langFactory, Expression expr, String typeName)
           
 void setBooleanNullable(boolean booleanNullable)
           
 void setWideningNumericImplicit(boolean wideningNumericImplicit)
           
 List<?> translate(Function function)
          Return a List of translated parts (LanguageObjects and Objects), or null if this FunctionModifier wishes to rely on the default translation of the conversion visitor.
 
Methods inherited from class org.teiid.translator.jdbc.FunctionModifier
getCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertModifier

public ConvertModifier()
Method Detail

addTypeConversion

public void addTypeConversion(FunctionModifier convert,
                              int... targetType)

addSourceConversion

public void addSourceConversion(FunctionModifier convert,
                                int... sourceType)

addTypeMapping

public void addTypeMapping(String nativeType,
                           int... targetType)

setWideningNumericImplicit

public void setWideningNumericImplicit(boolean wideningNumericImplicit)

addConvert

public void addConvert(int sourceType,
                       int targetType,
                       FunctionModifier convert)

translate

public List<?> translate(Function function)
Description copied from class: FunctionModifier
Return a List of translated parts (LanguageObjects and Objects), or null if this FunctionModifier wishes to rely on the default translation of the conversion visitor.

Specified by:
translate in class FunctionModifier
Parameters:
function - IFunction to be translated
Returns:
List of translated parts, or null

createConvertFunction

public static Function createConvertFunction(LanguageFactory langFactory,
                                             Expression expr,
                                             String typeName)

addNumericBooleanConversions

public void addNumericBooleanConversions()

setBooleanNullable

public void setBooleanNullable(boolean booleanNullable)


Copyright © 2011. All Rights Reserved.