Class DefaultInterceptorRegistry
- java.lang.Object
-
- de.hybris.platform.servicelayer.interceptor.impl.DefaultInterceptorRegistry
-
- All Implemented Interfaces:
InterceptorRegistry
public class DefaultInterceptorRegistry extends java.lang.Object implements InterceptorRegistry
Provides type interceptors based upon jalo types.
-
-
Constructor Summary
Constructors Constructor Description DefaultInterceptorRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddTypeInvalidationListener()Adds the composed type invalidation listener to the pool.protected voidassertLoaded()DOCTODO apidocprotected java.util.List<java.lang.String>getAssignableTypes(java.lang.String type)Returns all assignable types for a given type in super-type-first order.java.util.Collection<InitDefaultsInterceptor>getInitDefaultsInterceptors(java.lang.String type)protected TypeManagergetJaloTypeManager()java.util.Collection<LoadInterceptor>getLoadInterceptors(java.lang.String type)java.util.Collection<PrepareInterceptor>getPrepareInterceptors(java.lang.String type)java.util.Collection<RemoveInterceptor>getRemoveInterceptors(java.lang.String type)java.util.Collection<ValidateInterceptor>getValidateInterceptors(java.lang.String type)protected voidinit()protected booleanisValidTypeCode(java.lang.String code)Returnstrueif the given composed type code is part of the type systemvoidregisterInterceptor(InterceptorMapping mapping)Register anInterceptorwhich is of theInterceptorMappingto the registry.voidregisterInterceptor(java.lang.String type, Interceptor interceptor, java.util.Collection<Interceptor> replacements)Register a givenInterceptorto the registry.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext)voidsetInterceptorExecutionPolicy(InterceptorExecutionPolicy interceptorExecutionPolicy)voidsetInterceptorMappings(java.util.Collection<InterceptorMapping> configuredMappings)voidunregisterInterceptor(InterceptorMapping mapping)
-
-
-
Method Detail
-
getLoadInterceptors
public java.util.Collection<LoadInterceptor> getLoadInterceptors(java.lang.String type)
- Specified by:
getLoadInterceptorsin interfaceInterceptorRegistry- Parameters:
type- type code mapping string- Returns:
- collection containing
LoadInterceptorfor specific type code mapping
-
getPrepareInterceptors
public java.util.Collection<PrepareInterceptor> getPrepareInterceptors(java.lang.String type)
- Specified by:
getPrepareInterceptorsin interfaceInterceptorRegistry- Parameters:
type- type code mapping string- Returns:
- collection containing
PrepareInterceptorfor specific type code mapping
-
getRemoveInterceptors
public java.util.Collection<RemoveInterceptor> getRemoveInterceptors(java.lang.String type)
- Specified by:
getRemoveInterceptorsin interfaceInterceptorRegistry- Parameters:
type- type code mapping string- Returns:
- collection containing
RemoveInterceptorfor specific type code mapping
-
getValidateInterceptors
public java.util.Collection<ValidateInterceptor> getValidateInterceptors(java.lang.String type)
- Specified by:
getValidateInterceptorsin interfaceInterceptorRegistry- Parameters:
type- type code mapping string- Returns:
- collection containing
ValidateInterceptorfor specific type code mapping
-
getInitDefaultsInterceptors
public java.util.Collection<InitDefaultsInterceptor> getInitDefaultsInterceptors(java.lang.String type)
- Specified by:
getInitDefaultsInterceptorsin interfaceInterceptorRegistry- Parameters:
type- type code mapping string- Returns:
- collection containing
InitDefaultsInterceptorfor specific type code mapping
-
registerInterceptor
public void registerInterceptor(java.lang.String type, Interceptor interceptor, java.util.Collection<Interceptor> replacements)Register a givenInterceptorto the registry. This Interceptor is registered for the given type (and every subtype) and replaces (if provided) the Interceptors in the given replacements collection. If possible useregisterInterceptor(InterceptorMapping)instead!- Parameters:
type- for thisComposedTypecode (and any subtype) the Interceptor is registered.interceptor- the Interceptorreplacements- the given Interceptor replaces the Interceptors in this collection. Example: a LoadInterceptor for product replaces the LoadInterceptor for items because the productt load interceptor does a special product loading
-
registerInterceptor
public void registerInterceptor(InterceptorMapping mapping)
Register anInterceptorwhich is of theInterceptorMappingto the registry. The Interceptor is registered for aComposedTypecode (seeInterceptorMapping.setTypeCode(String)and, if provided, replace other registered Interceptors (seeInterceptorMapping.setReplacedInterceptors(Collection). Use this method instead ofregisterInterceptor(String, Interceptor, Collection)because the InterceptorMapping is sortable (SeeOrdered). An Interceptor with a low irder number will be executed first. If no order number is provided the default isOrdered.LOWEST_PRECEDENCE.- Parameters:
mapping- the InterceptorMapping contains the Interceptor, the typecode, the interceptors which will be replaced and an order number
-
unregisterInterceptor
public void unregisterInterceptor(InterceptorMapping mapping)
-
init
protected void init()
-
addTypeInvalidationListener
protected void addTypeInvalidationListener()
Adds the composed type invalidation listener to the pool.
-
getAssignableTypes
protected java.util.List<java.lang.String> getAssignableTypes(java.lang.String type)
Returns all assignable types for a given type in super-type-first order. All type codes are lower case!
-
setInterceptorMappings
public void setInterceptorMappings(java.util.Collection<InterceptorMapping> configuredMappings)
-
assertLoaded
protected void assertLoaded()
DOCTODO apidoc
-
getJaloTypeManager
protected TypeManager getJaloTypeManager()
- Returns:
- the (cached)
TypeManager.
-
isValidTypeCode
protected boolean isValidTypeCode(java.lang.String code)
Returnstrueif the given composed type code is part of the type system- Parameters:
code- theComposedTypecode- Returns:
falseotherwise
-
setInterceptorExecutionPolicy
public void setInterceptorExecutionPolicy(InterceptorExecutionPolicy interceptorExecutionPolicy)
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
-