Package io.jmix.core.impl
Class InstanceNameProviderImpl
java.lang.Object
io.jmix.core.impl.InstanceNameProviderImpl
- All Implemented Interfaces:
InstanceNameProvider
@Component("core_InstanceNameProvider")
public class InstanceNameProviderImpl
extends Object
implements InstanceNameProvider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CorePropertiesprotected DatatypeRegistryprotected ExtendedEntitiesprotected Messagesprotected Metadataprotected MetadataGenerationManagerprotected MetadataToolsprotected MethodArgumentsProviderprotected ContextArgumentResolverCompositeprotected final GenerationStateStore<InstanceNameProviderImpl.State> static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidEvicts cached instance name metadata for all entities.getInstanceName(InstanceNameProviderImpl.InstanceNameRec rec, Object instance) 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<?> clazz) Gets entity instance name defined byInstanceNameannotation inentityClassor its ancestor ifCoreProperties.instanceNameFallbackEnabledis true.protected Collection<MetaProperty> getInstanceNameProperties(MetaClass metaClass, @Nullable Method nameMethod, @Nullable MetaProperty nameProperty) getInstanceNameRelatedProperties(MetaClass metaClass, boolean useOriginal) Return a collection of properties included into entity's name pattern (seeInstanceName).protected InstanceNameProviderImpl.StategetState()protected booleanhasRuntimeInstanceNameAnnotation(MetaProperty metaProperty) booleanisInstanceNameDefined(Class<?> aClass) Checks ifInstanceNameannotation is present in an entity class, i.e.protected booleanisInstanceNameProperty(MetaProperty metaProperty) protected booleanisPreferredNameProperty(MetaProperty candidate, MetaProperty current) voidDrops instance-name cache entries associated with a retired metadata generation.@Nullable InstanceNameProviderImpl.InstanceNameRecparseNamePattern(MetaClass metaClass) protected MetaPropertyselectNameProperty(List<MetaProperty> nameProperties) voidsetResolvers(ContextArgumentResolverComposite resolvers)
-
Field Details
-
UNFETCHED_EXCEPTION_MESSAGE_PREFIX
- See Also:
-
metadata
-
extendedEntities
-
datatypeRegistry
-
messages
-
metadataTools
-
coreProperties
-
resolvers
-
methodArgumentsProvider
-
metadataGenerationManager
-
stateStore
-
-
Constructor Details
-
InstanceNameProviderImpl
public InstanceNameProviderImpl()
-
-
Method Details
-
getResolvers
-
setResolvers
-
getState
-
onMetadataGenerationRetired
Drops instance-name cache entries associated with a retired metadata generation.- Parameters:
event- retired-generation event
-
isInstanceNameDefined
Description copied from interface:InstanceNameProviderChecks ifInstanceNameannotation is present in an entity class, i.e. whether instance name can be obtained for entity instances.- Specified by:
isInstanceNameDefinedin interfaceInstanceNameProvider- Parameters:
aClass- an entity class to check- Returns:
trueifInstanceNameannotation is present,falseotherwise
-
getInstanceName
Description copied from interface:InstanceNameProviderGets entity instance name defined byInstanceNameannotation. IfInstanceNameannotation is not defined, returnsentity.toString().- Specified by:
getInstanceNamein interfaceInstanceNameProvider- Parameters:
instance- an entity instance to get instance name- Returns:
- instance name
-
getInstanceName
Description copied from interface:InstanceNameProviderGets entity instance name defined byInstanceNameannotation inentityClassor its ancestor ifCoreProperties.instanceNameFallbackEnabledis true.- Specified by:
getInstanceNamein interfaceInstanceNameProvider- Parameters:
instance- instanceclazz- class to get @InstanceName definition from- Returns:
- instance name
- See Also:
-
getInstanceName
Description copied from interface:InstanceNameProviderGets entity instance name defined byInstanceNameannotation inmetaClassor its ancestor ifCoreProperties.instanceNameFallbackEnabledis true.- Specified by:
getInstanceNamein interfaceInstanceNameProvider- Parameters:
instance- instancemetaClass- class to get @InstanceName definition from- Returns:
- instance name
- See Also:
-
getInstanceName
protected InstanceNameProviderImpl.EvaluationResult getInstanceName(InstanceNameProviderImpl.InstanceNameRec rec, Object instance) -
getInstanceNameRelatedProperties
public Collection<MetaProperty> getInstanceNameRelatedProperties(MetaClass metaClass, boolean useOriginal) Description copied from interface:InstanceNameProviderReturn a collection of properties included into entity's name pattern (seeInstanceName).- Specified by:
getInstanceNameRelatedPropertiesin interfaceInstanceNameProvider- 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
public void evictInstanceNameCache()Description copied from interface:InstanceNameProviderEvicts cached instance name metadata for all entities.- Specified by:
evictInstanceNameCachein interfaceInstanceNameProvider
-
getInstanceNameProperties
protected Collection<MetaProperty> getInstanceNameProperties(MetaClass metaClass, @Nullable Method nameMethod, @Nullable MetaProperty nameProperty) -
parseNamePattern
-
isInstanceNameProperty
-
selectNameProperty
-
isPreferredNameProperty
-
hasRuntimeInstanceNameAnnotation
-