Package io.jmix.core.impl
Class MetaModelLoader
java.lang.Object
io.jmix.core.impl.MetaModelLoader
INTERNAL.
Loads meta-model from a set of annotated Java classes.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
protected class
-
Field Summary
Modifier and TypeFieldDescriptionprotected DatatypeRegistry
protected FormatStringsRegistry
protected Messages
protected Stores
protected static final List<Class<? extends Annotation>>
protected static final String
protected static final String
protected static final String
protected static final String
-
Constructor Summary
ConstructorDescriptionMetaModelLoader
(DatatypeRegistry datatypes, Stores stores, FormatStringsRegistry formatStringsRegistry, Messages messages) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
assignInverse
(MetaPropertyImpl property, Range range, String inverseField) protected void
assignPropertyType
(AnnotatedElement field, MetaProperty property, Range range) protected void
assignStore
(MetaClass metaClass) protected void
assignStore
(MetaProperty metaProperty) buildSetterNames
(Field field) Builds a list of possible setter names for the field.protected MetaClassImpl
createClass
(Session session, Class<?> javaClass) protected Datatype
getAdaptiveDatatype
(MetaProperty metaProperty, Class<?> type) protected Datatype
getAdaptiveDatatype
(AnnotatedElement annotatedElement) protected Range.Cardinality
getCardinality
(Field field) protected Class
getFieldType
(Field field) protected Class
protected String
getInverseField
(Field field) protected String
getMetaClassName
(Class<?> javaClass) protected Class
getTypeOverride
(AnnotatedElement element) protected boolean
hasJpaAnnotation
(Class<?> javaClass) protected boolean
hasJpaAnnotation
(AnnotatedElement annotatedElement) protected void
initAncestors
(Session session, MetaClass metaClass) protected void
initInheritedProperties
(MetaClass metaClass) protected void
initProperties
(Session session, Class<?> clazz, MetaClassImpl metaClass, Collection<MetaModelLoader.RangeInitTask> tasks) protected boolean
isCollection
(Field field) protected boolean
isCollection
(Method method) protected boolean
isDefinedForDefaultValidationGroup
(Annotation annotation) protected boolean
isDefinedForValidationGroup
(Annotation annotation, Class groupClass, boolean inheritDefault) protected boolean
isEmbedded
(Field field) protected boolean
isJmixProperty
(Field field) protected boolean
isMandatory
(AccessibleObject base) protected boolean
protected boolean
protected boolean
isMetaPropertyField
(Field field) protected boolean
isMetaPropertyMethod
(Method method) protected boolean
protected boolean
isPrimaryKey
(Field field) protected boolean
isSystem
(Field field, MetaProperty metaProperty) protected boolean
isTransientFieldOfJpaEntity
(Class clazz, Field field) protected boolean
isUuidGeneratedValue
(MetaProperty metaProperty, Field field) protected void
loadBeanValidationAnnotations
(MetaProperty metaProperty, AnnotatedElement annotatedElement) protected MetaModelLoader.MetadataObjectInfo<MetaClass>
protected MetaModelLoader.MetadataObjectInfo<MetaProperty>
loadCollectionProperty
(Session session, MetaClassImpl metaClass, Field field) void
protected MetaModelLoader.MetadataObjectInfo<MetaProperty>
loadProperty
(Session session, MetaClassImpl metaClass, Field field) protected MetaModelLoader.MetadataObjectInfo<MetaProperty>
loadProperty
(Session session, MetaClassImpl metaClass, Method method, String name) protected void
loadPropertyAnnotations
(MetaProperty metaProperty, AnnotatedElement annotatedElement) protected MetaModelLoader.MetadataObjectInfo<Range>
protected void
onPropertyLoaded
(MetaProperty metaProperty, Field field) protected void
onPropertyLoaded
(MetaProperty metaProperty, Method method) protected boolean
setterExists
(Field field) protected boolean
setterExists
(Method getter) protected Class
-
Field Details
-
VALIDATION_MIN
- See Also:
-
VALIDATION_MAX
- See Also:
-
VALIDATION_NOTNULL_MESSAGE
- See Also:
-
VALIDATION_NOTNULL_UI_COMPONENT
- See Also:
-
SYSTEM_ANNOTATIONS
-
datatypes
-
stores
-
formatStringsRegistry
-
messages
-
-
Constructor Details
-
MetaModelLoader
@Autowired public MetaModelLoader(DatatypeRegistry datatypes, Stores stores, FormatStringsRegistry formatStringsRegistry, Messages messages)
-
-
Method Details
-
loadModel
-
initAncestors
-
loadClass
@Nullable protected MetaModelLoader.MetadataObjectInfo<MetaClass> loadClass(Session session, Class<?> javaClass) -
assignStore
-
initInheritedProperties
-
createClass
-
getMetaClassName
-
initProperties
protected void initProperties(Session session, Class<?> clazz, MetaClassImpl metaClass, Collection<MetaModelLoader.RangeInitTask> tasks) -
isMetaPropertyField
-
isJmixProperty
-
isTransientFieldOfJpaEntity
-
isMetaPropertyMethod
-
loadProperty
protected MetaModelLoader.MetadataObjectInfo<MetaProperty> loadProperty(Session session, MetaClassImpl metaClass, Field field) -
loadProperty
protected MetaModelLoader.MetadataObjectInfo<MetaProperty> loadProperty(Session session, MetaClassImpl metaClass, Method method, String name) -
loadCollectionProperty
protected MetaModelLoader.MetadataObjectInfo<MetaProperty> loadCollectionProperty(Session session, MetaClassImpl metaClass, Field field) -
onPropertyLoaded
-
assignStore
-
isSystem
-
getFieldTypeAccordingAnnotations
-
getTypeOverride
-
isMandatory
- Parameters:
base
- field or method for field-based or property-based access type- Returns:
-
getCardinality
-
getInverseField
-
isPrimaryKey
-
isUuidGeneratedValue
-
isEmbedded
-
hasJpaAnnotation
-
hasJpaAnnotation
-
isCollection
-
isMap
-
isMap
-
isCollection
-
onPropertyLoaded
-
loadPropertyAnnotations
protected void loadPropertyAnnotations(MetaProperty metaProperty, AnnotatedElement annotatedElement) -
loadBeanValidationAnnotations
protected void loadBeanValidationAnnotations(MetaProperty metaProperty, AnnotatedElement annotatedElement) -
isDefinedForDefaultValidationGroup
-
isDefinedForValidationGroup
protected boolean isDefinedForValidationGroup(Annotation annotation, Class groupClass, boolean inheritDefault) -
getAdaptiveDatatype
-
setterExists
-
buildSetterNames
Builds a list of possible setter names for the field. There may be two options:- In most cases the setter name is "set<FieldName>", e.g. "setPrice" for a field "price"
- There may be a special case for Kotlin entity. If the field name starts with "is" (e.g. "isApproved") then a setter name will be "setApproved", not "setIsApproved"
-
setterExists
-
assignPropertyType
-
loadRange
protected MetaModelLoader.MetadataObjectInfo<Range> loadRange(Session session, MetaProperty metaProperty, Class<?> type, Map<String, Object> map) -
getAdaptiveDatatype
-
getFieldType
-
toClass
-
assignInverse
-
isOrdered
-