Package io.jmix.core
Interface InstanceNameProvider
- All Known Implementing Classes:
InstanceNameProviderImpl
@NullMarked
public interface InstanceNameProvider
Provide instance name and instance name properties.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidEvicts cached instance name metadata for all entities.getInstanceName(Object instance) Gets entity instance name defined byInstanceNameannotation.getInstanceName(Object instance, MetaClass metaClass) Gets entity instance name defined byInstanceNameannotation inmetaClassor its ancestor ifCoreProperties.instanceNameFallbackEnabledis true.getInstanceName(Object instance, Class<?> entityClass) Gets entity instance name defined byInstanceNameannotation inentityClassor its ancestor ifCoreProperties.instanceNameFallbackEnabledis true.getInstanceNameRelatedProperties(MetaClass metaClass, boolean useOriginal) Return a collection of properties included into entity's name pattern (seeInstanceName).booleanisInstanceNameDefined(Class<?> aClass) Checks ifInstanceNameannotation is present in an entity class, i.e.
-
Method Details
-
isInstanceNameDefined
Checks ifInstanceNameannotation is present in an entity class, i.e. whether instance name can be obtained for entity instances.- Parameters:
aClass- an entity class to check- Returns:
trueifInstanceNameannotation is present,falseotherwise
-
getInstanceName
Gets entity instance name defined byInstanceNameannotation. IfInstanceNameannotation is not defined, returnsentity.toString().- Parameters:
instance- an entity instance to get instance name- Returns:
- instance name
-
getInstanceName
Gets entity instance name defined byInstanceNameannotation inmetaClassor its ancestor ifCoreProperties.instanceNameFallbackEnabledis true.- Parameters:
instance- instancemetaClass- class to get @InstanceName definition from- Returns:
- instance name
- See Also:
-
getInstanceName
Gets entity instance name defined byInstanceNameannotation inentityClassor its ancestor ifCoreProperties.instanceNameFallbackEnabledis true.- Parameters:
instance- instanceentityClass- class to get @InstanceName definition from- Returns:
- instance name
- See Also:
-
getInstanceNameRelatedProperties
Return a collection of properties included into entity's name pattern (seeInstanceName).- Parameters:
metaClass- entity metaclassuseOriginal- if true, and if the given metaclass doesn't define aInstanceNameand if it is an extended entity, this method tries to find a name pattern in an original entity- Returns:
- collection of the name pattern properties
-
evictInstanceNameCache
default void evictInstanceNameCache()Evicts cached instance name metadata for all entities.
-