use of org.apache.calcite.jdbc.JavaRecordType in project calcite by apache.
the class JavaTypeFactoryExtImpl method createStructType.
/**
* See <a href="http://stackoverflow.com/questions/16966629/what-is-the-difference-between-getfields-and-getdeclaredfields-in-java-reflectio">
* the difference between fields and declared fields</a>.
*/
@Override
public RelDataType createStructType(Class type) {
final List<RelDataTypeField> list = new ArrayList<>();
for (Field field : type.getDeclaredFields()) {
if (!Modifier.isStatic(field.getModifiers())) {
// FIXME: watch out for recursion
final Type fieldType = field.getType();
list.add(new RelDataTypeFieldImpl(field.getName(), list.size(), createType(fieldType)));
}
}
return canonize(new JavaRecordType(list, type));
}
Aggregations