Package org.apache.calcite.jdbc
Class JavaTypeFactoryImpl
- java.lang.Object
-
- org.apache.calcite.rel.type.RelDataTypeFactoryImpl
-
- org.apache.calcite.sql.type.SqlTypeFactoryImpl
-
- org.apache.calcite.jdbc.JavaTypeFactoryImpl
-
- All Implemented Interfaces:
JavaTypeFactory
,RelDataTypeFactory
- Direct Known Subclasses:
JavaTypeFactoryExtImpl
public class JavaTypeFactoryImpl extends SqlTypeFactoryImpl implements JavaTypeFactory
Implementation ofJavaTypeFactory
.NOTE: This class is experimental and subject to change/removal without notice.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
JavaTypeFactoryImpl.RecordFieldImpl
Implementation of a field.static class
JavaTypeFactoryImpl.SyntheticRecordType
Synthetic record type.-
Nested classes/interfaces inherited from class org.apache.calcite.rel.type.RelDataTypeFactoryImpl
RelDataTypeFactoryImpl.JavaType
-
Nested classes/interfaces inherited from interface org.apache.calcite.rel.type.RelDataTypeFactory
RelDataTypeFactory.Builder, RelDataTypeFactory.FieldInfo, RelDataTypeFactory.FieldInfoBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.util.List<Pair<java.lang.reflect.Type,java.lang.Boolean>>,JavaTypeFactoryImpl.SyntheticRecordType>
syntheticTypes
-
Fields inherited from class org.apache.calcite.rel.type.RelDataTypeFactoryImpl
typeSystem
-
-
Constructor Summary
Constructors Constructor Description JavaTypeFactoryImpl()
JavaTypeFactoryImpl(RelDataTypeSystem typeSystem)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RelDataType
createStructType(java.lang.Class type)
Creates a record type based upon the public fields of a Java class.java.lang.reflect.Type
createSyntheticType(java.util.List<java.lang.reflect.Type> types)
Creates a synthetic Java class whose fields have the given Java types.private java.lang.reflect.Type
createSyntheticType(RelRecordType type)
Creates a synthetic Java class whose fields have the same names and relational types.RelDataType
createType(java.lang.reflect.Type type)
Creates a type, deducing whether a record, scalar or primitive type is needed.private java.lang.reflect.Type
fieldType(java.lang.reflect.Field field)
Returns the type of a field.java.lang.reflect.Type
getJavaClass(RelDataType type)
private JavaTypeFactoryImpl.SyntheticRecordType
register(JavaTypeFactoryImpl.SyntheticRecordType syntheticType)
RelDataType
toSql(RelDataType type)
Converts a type in Java format to a SQL-oriented type.static RelDataType
toSql(RelDataTypeFactory typeFactory, RelDataType type)
Converts a type in Java format to a SQL-oriented type.-
Methods inherited from class org.apache.calcite.sql.type.SqlTypeFactoryImpl
canonize, createArrayType, createMapType, createMultisetType, createSqlIntervalType, createSqlType, createSqlType, createSqlType, createTypeWithCharsetAndCollation, createTypeWithNullability, createUnknownType, leastRestrictive
-
Methods inherited from class org.apache.calcite.rel.type.RelDataTypeFactoryImpl
builder, canonize, copyType, createDecimalProduct, createDecimalQuotient, createJavaType, createJoinType, createStructType, createStructType, createStructType, createStructType, getDefaultCharset, getTypeSystem, isJavaType, leastRestrictiveStructuredType, useDoubleMultiplication
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.rel.type.RelDataTypeFactory
builder, copyType, createArrayType, createDecimalProduct, createDecimalQuotient, createJavaType, createJoinType, createMapType, createMultisetType, createSqlIntervalType, createSqlType, createSqlType, createSqlType, createStructType, createStructType, createStructType, createStructType, createTypeWithCharsetAndCollation, createTypeWithNullability, createUnknownType, getDefaultCharset, getTypeSystem, leastRestrictive, useDoubleMultiplication
-
-
-
-
Field Detail
-
syntheticTypes
private final java.util.Map<java.util.List<Pair<java.lang.reflect.Type,java.lang.Boolean>>,JavaTypeFactoryImpl.SyntheticRecordType> syntheticTypes
-
-
Constructor Detail
-
JavaTypeFactoryImpl
public JavaTypeFactoryImpl()
-
JavaTypeFactoryImpl
public JavaTypeFactoryImpl(RelDataTypeSystem typeSystem)
-
-
Method Detail
-
createStructType
public RelDataType createStructType(java.lang.Class type)
Description copied from interface:JavaTypeFactory
Creates a record type based upon the public fields of a Java class.- Specified by:
createStructType
in interfaceJavaTypeFactory
- Parameters:
type
- Java class- Returns:
- Record type that remembers its Java class
-
fieldType
private java.lang.reflect.Type fieldType(java.lang.reflect.Field field)
Returns the type of a field.Takes into account
Array
annotations if present.
-
createType
public RelDataType createType(java.lang.reflect.Type type)
Description copied from interface:JavaTypeFactory
Creates a type, deducing whether a record, scalar or primitive type is needed.- Specified by:
createType
in interfaceJavaTypeFactory
- Parameters:
type
- Java type, such as aClass
- Returns:
- Record or scalar type
-
getJavaClass
public java.lang.reflect.Type getJavaClass(RelDataType type)
- Specified by:
getJavaClass
in interfaceJavaTypeFactory
-
toSql
public RelDataType toSql(RelDataType type)
Description copied from interface:JavaTypeFactory
Converts a type in Java format to a SQL-oriented type.- Specified by:
toSql
in interfaceJavaTypeFactory
-
toSql
public static RelDataType toSql(RelDataTypeFactory typeFactory, RelDataType type)
Converts a type in Java format to a SQL-oriented type.
-
createSyntheticType
public java.lang.reflect.Type createSyntheticType(java.util.List<java.lang.reflect.Type> types)
Description copied from interface:JavaTypeFactory
Creates a synthetic Java class whose fields have the given Java types.- Specified by:
createSyntheticType
in interfaceJavaTypeFactory
-
register
private JavaTypeFactoryImpl.SyntheticRecordType register(JavaTypeFactoryImpl.SyntheticRecordType syntheticType)
-
createSyntheticType
private java.lang.reflect.Type createSyntheticType(RelRecordType type)
Creates a synthetic Java class whose fields have the same names and relational types.
-
-