Class AbstractHandlerAndFilterDecorator
- java.lang.Object
-
- org.forgerock.openig.decoration.helper.AbstractDecorator
-
- org.forgerock.openig.decoration.helper.AbstractHandlerAndFilterDecorator
-
- All Implemented Interfaces:
Decorator
- Direct Known Subclasses:
BaseUriDecorator,CaptureDecorator,TimerDecorator
public abstract class AbstractHandlerAndFilterDecorator extends AbstractDecorator
An AbstractHandlerAndFilterDecorator is the base implementation for decorators working only onFilterandHandler.Implementors just have to implement the dedicated
decorateFilter(Filter, JsonValue, Context)anddecorateHandler(Handler, JsonValue, Context)for decorating Filter and Handler respectively.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractHandlerAndFilterDecorator(String name)Forces to give the name of the decorator.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanaccepts(Class<?> type)Returnstrueif this decorator is compatible with the provided component type.Objectdecorate(Object delegate, org.forgerock.json.JsonValue decoratorConfig, Context context)Decorates the provideddelegateinstance with the provideddecoratorConfigconfiguration.protected abstract org.forgerock.http.FilterdecorateFilter(org.forgerock.http.Filter delegate, org.forgerock.json.JsonValue decoratorConfig, Context context)Decorates the provideddelegateFilterinstance with the provideddecoratorConfigconfiguration.protected abstract org.forgerock.http.HandlerdecorateHandler(org.forgerock.http.Handler delegate, org.forgerock.json.JsonValue decoratorConfig, Context context)Decorates the provideddelegateHandlerinstance with the provideddecoratorConfigconfiguration.-
Methods inherited from class org.forgerock.openig.decoration.helper.AbstractDecorator
getLogger
-
-
-
-
Constructor Detail
-
AbstractHandlerAndFilterDecorator
protected AbstractHandlerAndFilterDecorator(String name)
Forces to give the name of the decorator.- Parameters:
name- The name of the decorator.
-
-
Method Detail
-
accepts
public boolean accepts(Class<?> type)
Description copied from interface:DecoratorReturnstrueif this decorator is compatible with the provided component type. Note that a return value oftruedoes not necessarily indicate that decoration will be performed since it may also depend on other factors- Parameters:
type- type under test- Returns:
trueif the decorator can decorate instance of the given type,falseotherwise.
-
decorate
public Object decorate(Object delegate, org.forgerock.json.JsonValue decoratorConfig, Context context) throws HeapException
Description copied from interface:DecoratorDecorates the provideddelegateinstance with the provideddecoratorConfigconfiguration. The implementation should take care of not changing the base type of the delegate.- Parameters:
delegate- instance to be decorateddecoratorConfig- the decorator configuration to applycontext- contextual information of the decorated instance- Returns:
- a decorated instance (or original delegate)
- Throws:
HeapException- when decoration fails
-
decorateFilter
protected abstract org.forgerock.http.Filter decorateFilter(org.forgerock.http.Filter delegate, org.forgerock.json.JsonValue decoratorConfig, Context context) throws HeapExceptionDecorates the provideddelegateFilterinstance with the provideddecoratorConfigconfiguration.- Parameters:
delegate- Filter instance to be decorateddecoratorConfig- the decorator configuration to applycontext- contextual information of the decorated instance- Returns:
- a decorated filter instance (or original filter delegate)
- Throws:
HeapException- when decoration fails
-
decorateHandler
protected abstract org.forgerock.http.Handler decorateHandler(org.forgerock.http.Handler delegate, org.forgerock.json.JsonValue decoratorConfig, Context context) throws HeapExceptionDecorates the provideddelegateHandlerinstance with the provideddecoratorConfigconfiguration.- Parameters:
delegate- Handler instance to be decorateddecoratorConfig- the decorator configuration to applycontext- contextual information of the decorated instance- Returns:
- a decorated handler instance (or original handler delegate)
- Throws:
HeapException- when decoration fails
-
-