Search in sources :

Example 1 with DatatypeRange

use of io.jmix.core.metamodel.model.impl.DatatypeRange 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);
}
Also used : ClassRange(io.jmix.core.metamodel.model.impl.ClassRange) EnumerationImpl(io.jmix.core.metamodel.datatype.impl.EnumerationImpl) EnumClass(io.jmix.core.metamodel.datatype.impl.EnumClass) MetaProperty(io.jmix.core.metamodel.model.MetaProperty) EnumerationRange(io.jmix.core.metamodel.model.impl.EnumerationRange) ClassRange(io.jmix.core.metamodel.model.impl.ClassRange) Range(io.jmix.core.metamodel.model.Range) DatatypeRange(io.jmix.core.metamodel.model.impl.DatatypeRange) EnumerationRange(io.jmix.core.metamodel.model.impl.EnumerationRange) DatatypeRange(io.jmix.core.metamodel.model.impl.DatatypeRange) Session(io.jmix.core.metamodel.model.Session) Datatype(io.jmix.core.metamodel.datatype.Datatype)

Aggregations

Datatype (io.jmix.core.metamodel.datatype.Datatype)1 EnumClass (io.jmix.core.metamodel.datatype.impl.EnumClass)1 EnumerationImpl (io.jmix.core.metamodel.datatype.impl.EnumerationImpl)1 MetaProperty (io.jmix.core.metamodel.model.MetaProperty)1 Range (io.jmix.core.metamodel.model.Range)1 Session (io.jmix.core.metamodel.model.Session)1 ClassRange (io.jmix.core.metamodel.model.impl.ClassRange)1 DatatypeRange (io.jmix.core.metamodel.model.impl.DatatypeRange)1 EnumerationRange (io.jmix.core.metamodel.model.impl.EnumerationRange)1