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 void
addTypeInvalidationListener()
Adds the composed type invalidation listener to the pool.protected void
assertLoaded()
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 TypeManager
getJaloTypeManager()
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 void
init()
protected boolean
isValidTypeCode(java.lang.String code)
Returnstrue
if the given composed type code is part of the type systemvoid
registerInterceptor(InterceptorMapping mapping)
Register anInterceptor
which is of theInterceptorMapping
to the registry.void
registerInterceptor(java.lang.String type, Interceptor interceptor, java.util.Collection<Interceptor> replacements)
Register a givenInterceptor
to the registry.void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
void
setInterceptorExecutionPolicy(InterceptorExecutionPolicy interceptorExecutionPolicy)
void
setInterceptorMappings(java.util.Collection<InterceptorMapping> configuredMappings)
void
unregisterInterceptor(InterceptorMapping mapping)
-
-
-
Method Detail
-
getLoadInterceptors
public java.util.Collection<LoadInterceptor> getLoadInterceptors(java.lang.String type)
- Specified by:
getLoadInterceptors
in interfaceInterceptorRegistry
- Parameters:
type
- type code mapping string- Returns:
- collection containing
LoadInterceptor
for specific type code mapping
-
getPrepareInterceptors
public java.util.Collection<PrepareInterceptor> getPrepareInterceptors(java.lang.String type)
- Specified by:
getPrepareInterceptors
in interfaceInterceptorRegistry
- Parameters:
type
- type code mapping string- Returns:
- collection containing
PrepareInterceptor
for specific type code mapping
-
getRemoveInterceptors
public java.util.Collection<RemoveInterceptor> getRemoveInterceptors(java.lang.String type)
- Specified by:
getRemoveInterceptors
in interfaceInterceptorRegistry
- Parameters:
type
- type code mapping string- Returns:
- collection containing
RemoveInterceptor
for specific type code mapping
-
getValidateInterceptors
public java.util.Collection<ValidateInterceptor> getValidateInterceptors(java.lang.String type)
- Specified by:
getValidateInterceptors
in interfaceInterceptorRegistry
- Parameters:
type
- type code mapping string- Returns:
- collection containing
ValidateInterceptor
for specific type code mapping
-
getInitDefaultsInterceptors
public java.util.Collection<InitDefaultsInterceptor> getInitDefaultsInterceptors(java.lang.String type)
- Specified by:
getInitDefaultsInterceptors
in interfaceInterceptorRegistry
- Parameters:
type
- type code mapping string- Returns:
- collection containing
InitDefaultsInterceptor
for specific type code mapping
-
registerInterceptor
public void registerInterceptor(java.lang.String type, Interceptor interceptor, java.util.Collection<Interceptor> replacements)
Register a givenInterceptor
to 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 thisComposedType
code (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 anInterceptor
which is of theInterceptorMapping
to the registry. The Interceptor is registered for aComposedType
code (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)
Returnstrue
if the given composed type code is part of the type system- Parameters:
code
- theComposedType
code- Returns:
false
otherwise
-
setInterceptorExecutionPolicy
public void setInterceptorExecutionPolicy(InterceptorExecutionPolicy interceptorExecutionPolicy)
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
-
-