org.broadleafcommerce.core.extension
Class ExtensionManager<T extends ExtensionHandler>
java.lang.Object
org.broadleafcommerce.core.extension.ExtensionManager<T>
- Type Parameters:
T -
- All Implemented Interfaces:
- InvocationHandler
- Direct Known Subclasses:
- MergeCartServiceExtensionManager, OfferServiceExtensionManager, OrderDaoExtensionManager, OrderServiceExtensionManager, SolrSearchServiceExtensionManager
public abstract class ExtensionManager<T extends ExtensionHandler>
- extends Object
- implements InvocationHandler
The ExtensionManager pattern is intended for out of box components to be extended by Broadleaf modules.
Each component that needs an extension should define an interface which is a descendant of ExtensionHandler.
The concrete ExtensionManager class will utilize that interface as a parameter (e.g. T below).
The default extension manager pattern loops through all handlers and examines their ExtensionResultStatusType
to determine whether or not to continue with other handlers.
- Author:
- bpolster
|
Constructor Summary |
ExtensionManager(Class<T> _clazz)
Should take in a className that matches the ExtensionHandler interface being managed. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
handlersSorted
protected boolean handlersSorted
LOCK_OBJECT
protected static String LOCK_OBJECT
extensionHandler
protected T extends ExtensionHandler extensionHandler
handlers
protected List<T extends ExtensionHandler> handlers
ExtensionManager
public ExtensionManager(Class<T> _clazz)
- Should take in a className that matches the ExtensionHandler interface being managed.
- Parameters:
className -
getProxy
public T getProxy()
getHandlers
public List<T> getHandlers()
setHandlers
public void setHandlers(List<T> handlers)
shouldContinue
public boolean shouldContinue(ExtensionResultStatusType result,
ExtensionHandler handler,
Method method,
Object[] args)
- Utility method that is useful for determining whether or not an ExtensionManager implementation
should continue after processing a ExtensionHandler call.
By default, returns true for CONTINUE
- Returns:
continueOnHandled
public boolean continueOnHandled()
- Returns whether or not this extension manager continues on
ExtensionResultStatusType.HANDLED.
- Returns:
getPriority
public int getPriority()
ExtensionManagers don't really need a priority but they pick up this property due to the
fact that we want them to implement the same interface as the handlers they are managing.
- Returns:
invoke
public Object invoke(Object proxy,
Method method,
Object[] args)
throws Throwable
- Specified by:
invoke in interface InvocationHandler
- Throws:
Throwable
Copyright © 2013. All Rights Reserved.