Toggle navigation
Home
com.speedment.generator.standard.internal.util.EntityTranslatorSupport.FieldType to com.speedment.runtime.typemapper.TypeMapper.Category
No. of Instances - 1
No. of Commits - 1
No. of Projects - {'speedment'}
Hierarchy/Composition: -
Primitive Info: -
NameSpace: Internal -> Internal
Mapping:
Add or Remove Method invocation
EntityTranslatorSupport.getForeignKey(table,column).map(fkc -> { final Type type, implType; final Type fkType=new TranslatorSupport<>(injector,fkc.findForeignTable().orElseThrow(() -> new SpeedmentException("Could not find referenced foreign table '" + fkc.getForeignTableName() + "'."))).entityType(); file.add(Import.of(fkType)); switch (fieldType) { case STRING: type=SimpleParameterizedType.create(StringForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(StringForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case BYTE: type=SimpleParameterizedType.create(ByteForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(ByteForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case SHORT: type=SimpleParameterizedType.create(ShortForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(ShortForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case INT: type=SimpleParameterizedType.create(IntForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(IntForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case LONG: type=SimpleParameterizedType.create(LongForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(LongForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case FLOAT: type=SimpleParameterizedType.create(FloatForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(FloatForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case DOUBLE: type=SimpleParameterizedType.create(DoubleForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(DoubleForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case CHAR: type=SimpleParameterizedType.create(CharForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(CharForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case BOOLEAN: throw new UnsupportedOperationException("Boolean foreign key fields are not supported."); case COMPARABLE: type=SimpleParameterizedType.create(ComparableForeignKeyField.class,entityType,databaseType,mapping,fkType); implType=SimpleParameterizedType.create(ComparableForeignKeyFieldImpl.class,entityType,databaseType,mapping,fkType); break; case REFERENCE: throw new UnsupportedOperationException("Foreign key types that are not either primitive " + "or comparable are not supported."); default : throw new UnsupportedOperationException("Unknown enum constant '" + fieldType + "'."); } return new ReferenceFieldType(type,implType); } )
to
EntityTranslatorSupport.getForeignKey(table,column).map(fkc -> { final Type type, implType; final Type fkType=new TranslatorSupport<>(injector,fkc.findForeignTable().orElseThrow(() -> new SpeedmentException("Could not find referenced foreign table '" + fkc.getForeignTableName() + "'."))).entityType(); file.add(Import.of(fkType)); switch (category) { case STRING: type=SimpleParameterizedType.create(StringForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(StringForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case BYTE: type=SimpleParameterizedType.create(ByteForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(ByteForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case SHORT: type=SimpleParameterizedType.create(ShortForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(ShortForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case INT: type=SimpleParameterizedType.create(IntForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(IntForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case LONG: type=SimpleParameterizedType.create(LongForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(LongForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case FLOAT: type=SimpleParameterizedType.create(FloatForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(FloatForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case DOUBLE: type=SimpleParameterizedType.create(DoubleForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(DoubleForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case CHAR: type=SimpleParameterizedType.create(CharForeignKeyField.class,entityType,databaseType,fkType); implType=SimpleParameterizedType.create(CharForeignKeyFieldImpl.class,entityType,databaseType,fkType); break; case BOOLEAN: throw new UnsupportedOperationException("Boolean foreign key fields are not supported."); case COMPARABLE: type=SimpleParameterizedType.create(ComparableForeignKeyField.class,entityType,databaseType,javaType,fkType); implType=SimpleParameterizedType.create(ComparableForeignKeyFieldImpl.class,entityType,databaseType,javaType,fkType); break; case REFERENCE: throw new UnsupportedOperationException("Foreign key types that are not either primitive " + "or comparable are not supported."); default : throw new UnsupportedOperationException("Unknown enum constant '" + category + "'."); } return new ReferenceFieldType(type,implType); } )
Rename Variable
fieldType
to
category