public Type createSyntheticType(List<Type> types) { if (types.isEmpty()) { // Unit is a pre-defined synthetic type to be used when there are 0 // fields. Because all instances are the same, we use a singleton. return Unit.class; } final String name = "Record" + types.size() + "_" + syntheticTypes.size(); final SyntheticRecordType syntheticType = new SyntheticRecordType(null, name); for (final Ord<Type> ord : Ord.zip(types)) { syntheticType.fields.add( new RecordFieldImpl( syntheticType, "f" + ord.i, ord.e, !Primitive.is(ord.e), Modifier.PUBLIC)); } return register(syntheticType); }
public Type createSyntheticType(List<Type> types) { if (types.isEmpty()) { // Unit is a pre-defined synthetic type to be used when there are 0 // fields. Because all instances are the same, we use a singleton. return Unit.class; } final String name = "Record" + types.size() + "_" + syntheticTypes.size(); final SyntheticRecordType syntheticType = new SyntheticRecordType(null, name); for (final Ord<Type> ord : Ord.zip(types)) { syntheticType.fields.add( new RecordFieldImpl( syntheticType, "f" + ord.i, ord.e, !Primitive.is(ord.e), Modifier.PUBLIC)); } return register(syntheticType); }
/** Creates a synthetic Java class whose fields have the same names and * relational types. */ private Type createSyntheticType(RelRecordType type) { final String name = "Record" + type.getFieldCount() + "_" + syntheticTypes.size(); final SyntheticRecordType syntheticType = new SyntheticRecordType(type, name); for (final RelDataTypeField recordField : type.getFieldList()) { final Type javaClass = getJavaClass(recordField.getType()); syntheticType.fields.add( new RecordFieldImpl( syntheticType, recordField.getName(), javaClass, recordField.getType().isNullable() && !Primitive.is(javaClass), Modifier.PUBLIC)); } return register(syntheticType); }
/** Creates a synthetic Java class whose fields have the same names and * relational types. */ private Type createSyntheticType(RelRecordType type) { final String name = "Record" + type.getFieldCount() + "_" + syntheticTypes.size(); final SyntheticRecordType syntheticType = new SyntheticRecordType(type, name); for (final RelDataTypeField recordField : type.getFieldList()) { final Type javaClass = getJavaClass(recordField.getType()); syntheticType.fields.add( new RecordFieldImpl( syntheticType, recordField.getName(), javaClass, recordField.getType().isNullable() && !Primitive.is(javaClass), Modifier.PUBLIC)); } return register(syntheticType); }