use of io.jmix.core.metamodel.model.impl.EnumerationRange in project jmix by jmix-framework.
the class KeyValueMetaPropertyBuilder method build.
public KeyValueMetaProperty build(MetaClass metaClass, String name, Class javaClass) {
MetaProperty.Type type;
Range range;
Session metadataSession = metadata.getSession();
if (Entity.class.isAssignableFrom(javaClass)) {
range = new ClassRange(metadataSession.findClass(javaClass));
type = MetaProperty.Type.ASSOCIATION;
} else if (EnumClass.class.isAssignableFrom(javaClass)) {
@SuppressWarnings("unchecked") EnumerationImpl enumeration = new EnumerationImpl(javaClass);
range = new EnumerationRange(enumeration);
type = MetaProperty.Type.ENUM;
} else {
@SuppressWarnings("unchecked") Datatype datatype = datatypeRegistry.get(javaClass);
range = new DatatypeRange(datatype);
type = MetaProperty.Type.DATATYPE;
}
return new KeyValueMetaProperty(metaClass, name, javaClass, range, type);
}
Aggregations