public static <K> TypeInfo<K> getPrimaryKeyType(TypeManager typeManager, Class<? extends RawEntity<K>> type) { return typeManager.getType(getPrimaryKeyClassType(type)); }
public static <K> TypeInfo<K> getPrimaryKeyType(TypeManager typeManager, Class<? extends RawEntity<K>> type) { return typeManager.getType(getPrimaryKeyClassType(type)); }
@SuppressWarnings("unchecked") public <T> TypeInfo<T> getType(Class<T> javaType, TypeQualifiers qualifiers) { if (RawEntity.class.isAssignableFrom(javaType)) { final Class<RawEntity<Object>> entityType = (Class<RawEntity<Object>>) javaType; final Class<Object> primaryKeyClass = Common.getPrimaryKeyClassType(entityType); final TypeInfo<Object> primaryKeyTypeInfo = getType(primaryKeyClass); final LogicalType<RawEntity<Object>> logicalType = LogicalTypes.entityType(entityType, primaryKeyTypeInfo, primaryKeyClass); return (TypeInfo<T>) new TypeInfo<RawEntity<Object>>(logicalType, primaryKeyTypeInfo.getSchemaProperties(), primaryKeyTypeInfo.getQualifiers()); } for (Class<?> clazz = javaType; clazz != null; clazz = clazz.getSuperclass()) { if (classIndex.containsKey(clazz)) { return (TypeInfo<T>) findTypeWithQualifiers(classIndex.get(clazz), qualifiers); } } throw new RuntimeException("Unrecognized type: " + javaType.getName()); }
@SuppressWarnings("unchecked") public <T> TypeInfo<T> getType(Class<T> javaType, TypeQualifiers qualifiers) { if (RawEntity.class.isAssignableFrom(javaType)) { final Class<RawEntity<Object>> entityType = (Class<RawEntity<Object>>) javaType; final Class<Object> primaryKeyClass = Common.getPrimaryKeyClassType(entityType); final TypeInfo<Object> primaryKeyTypeInfo = getType(primaryKeyClass); final LogicalType<RawEntity<Object>> logicalType = LogicalTypes.entityType(entityType, primaryKeyTypeInfo, primaryKeyClass); return (TypeInfo<T>) new TypeInfo<RawEntity<Object>>(logicalType, primaryKeyTypeInfo.getSchemaProperties(), primaryKeyTypeInfo.getQualifiers()); } for (Class<?> clazz = javaType; clazz != null; clazz = clazz.getSuperclass()) { if (classIndex.containsKey(clazz)) { return (TypeInfo<T>) findTypeWithQualifiers(classIndex.get(clazz), qualifiers); } } throw new RuntimeException("Unrecognized type: " + javaType.getName()); }