Class DefaultModelConverterRegistry
java.lang.Object
de.hybris.platform.servicelayer.event.impl.AbstractEventListener<AfterTenantRestartEvent>
de.hybris.platform.servicelayer.internal.converter.impl.DefaultModelConverterRegistry
- All Implemented Interfaces:
ConverterRegistry,EventListener,org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener<AfterTenantRestartEvent>
public class DefaultModelConverterRegistry
extends AbstractEventListener<AfterTenantRestartEvent>
implements ConverterRegistry
Default implementation of the
ConverterRegistry interface.- Since:
- 4.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidClears all registered converters.protected ModelConvertercreateDefaultConverter(String code, Class modelClass) getAllClasses(Class clazz) getAllSuperTypes(String type) getAllTypes(String type) protected TypeManagergetMappedType(Class<?> modelClass) getModelConverterByModel(Object model) Gets the converted registered based on provided model.getModelConverterByModelType(Class<?> modelClass) Gets the converter registered by a model type.Gets the converter registered by a source type.Gets all registered converters.Allows to fetch model service.protected StringgetSourceTypeFromModel(Object model) booleanbooleanprotected booleanisAssignableFrom(String superType, String type) protected booleanisValidTypeCode(String code) protected voidRegisters all configured converters injected viasetModelConverterMappings(Collection).protected voidRegisters default converters for all applicable types.protected voidloadDefaults(boolean doLogError) protected voidonEvent(AfterTenantRestartEvent event) This method is called byApplicationListener.onApplicationEvent(ApplicationEvent)and processes the given event.voidregisterModelConverter(String type, Class modelClass, ModelConverter converter) Directly registers new converter mapping.required by the clearing model converter registry instance see HOR-176voidsetCommonI18NService(CommonI18NService commonI18NService) voidsetDefaulItemModelSerializationStrategy(SerializationStrategy defaulItemModelSerializationStrategy) voidsetI18nService(I18NService i18nService) voidsetModelConverterMappings(Collection<ModelConverterMapping> configuredMappings) voidsetModelService(ModelService modelService) voidsetSelfHealingService(SelfHealingService selfHealingService) voidsetSourceTransformer(SourceTransformer sourceTransformer) Methods inherited from class de.hybris.platform.servicelayer.event.impl.AbstractEventListener
afterPropertiesSet, onApplicationEvent, setApplicationContext, setClusterService, setTenantService
-
Constructor Details
-
DefaultModelConverterRegistry
public DefaultModelConverterRegistry()
-
-
Method Details
-
onEvent
Description copied from class:AbstractEventListenerThis method is called byApplicationListener.onApplicationEvent(ApplicationEvent)and processes the given event.- Specified by:
onEventin classAbstractEventListener<AfterTenantRestartEvent>- Parameters:
event- the event to be processed- See Also:
-
ApplicationListener.onApplicationEvent(ApplicationEvent)
-
setCommonI18NService
-
getCommonI18NService
-
getModelService
Description copied from interface:ConverterRegistryAllows to fetch model service. This is intented to be used from inside ofModelConverterwhich are connected to this registry viaModelConverter.init(ConverterRegistry).- Specified by:
getModelServicein interfaceConverterRegistry
-
setModelService
-
setModelConverterMappings
-
getMappedType
- Specified by:
getMappedTypein interfaceConverterRegistry- Returns:
- for the given model class the mapped jalo type code.
nullotherwise.
-
getModelConverterByModelType
Description copied from interface:ConverterRegistryGets the converter registered by a model type.- Specified by:
getModelConverterByModelTypein interfaceConverterRegistry- Parameters:
modelClass- modelClass for which a converter is needed- Returns:
- registered converter matching given key
-
getModelConverterBySourceType
Description copied from interface:ConverterRegistryGets the converter registered by a source type.- Specified by:
getModelConverterBySourceTypein interfaceConverterRegistry- Parameters:
key- key for which a converter is needed- Returns:
- registered converter matching given key
-
removeModelConverterBySourceType
Description copied from interface:ConverterRegistryrequired by the clearing model converter registry instance see HOR-176- Specified by:
removeModelConverterBySourceTypein interfaceConverterRegistry
-
registerModelConverter
Directly registers new converter mapping.- Parameters:
type- the type codemodelClass- the model classconverter- the converter
-
loadDefaults
protected void loadDefaults(boolean doLogError) -
assertDefaultsLoaded
protected void assertDefaultsLoaded() -
loadConfiguredMappings
protected void loadConfiguredMappings()Registers all configured converters injected viasetModelConverterMappings(Collection). -
loadDefaultMappings
protected void loadDefaultMappings()Registers default converters for all applicable types. -
createDefaultConverter
-
getJaloTypeManager
-
getAllTypes
-
isValidTypeCode
-
isAssignableFrom
-
getAllClasses
-
getAllSuperTypes
-
getI18nService
- Returns:
- the i18nService
-
setI18nService
- Parameters:
i18nService- the i18nService to set
-
getSourceTransformer
-
setSourceTransformer
-
getSelfHealingService
-
setSelfHealingService
-
getDefaulItemModelSerializationStrategy
- Returns:
- the defaulItemModelSerializationStrategy
-
setDefaulItemModelSerializationStrategy
public void setDefaulItemModelSerializationStrategy(SerializationStrategy defaulItemModelSerializationStrategy) - Parameters:
defaulItemModelSerializationStrategy- the defaulItemModelSerializationStrategy to set
-
hasModelConverterForModelType
- Specified by:
hasModelConverterForModelTypein interfaceConverterRegistry- Returns:
trueif for the given model class aModelConverterexists.Falseotherwise.
-
hasModelConverterForSourceType
- Specified by:
hasModelConverterForSourceTypein interfaceConverterRegistry- Returns:
trueif for the given composed type code aModelConverterexists.Falseotherwise.
-
getModelConverters
Description copied from interface:ConverterRegistryGets all registered converters. Access to collection has to be synchronized by this in cause of probable ongoing changes.- Specified by:
getModelConvertersin interfaceConverterRegistry
-
clearModelConverters
public void clearModelConverters()Description copied from interface:ConverterRegistryClears all registered converters.- Specified by:
clearModelConvertersin interfaceConverterRegistry
-
getModelConverterByModel
Description copied from interface:ConverterRegistryGets the converted registered based on provided model.- Specified by:
getModelConverterByModelin interfaceConverterRegistry- Parameters:
model- Model- Returns:
- registered converted matching the given model
-
getSourceTypeFromModel
-