cleanup TODOs for decoration
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
5cc07994c0
commit
461c306fcf
|
@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
|
|||
* <p>
|
||||
* Can be found in the ServletContext Attributes at the {@link #ATTR DecoratedObjectFactory.ATTR} key.
|
||||
*/
|
||||
public class DecoratedObjectFactory implements Iterable<Decorator>
|
||||
public class DecoratedObjectFactory implements Iterable<Decorator>, Decorator
|
||||
{
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DecoratedObjectFactory.class);
|
||||
|
||||
|
@ -43,8 +43,6 @@ public class DecoratedObjectFactory implements Iterable<Decorator>
|
|||
|
||||
private static final ThreadLocal<Object> decoratorInfo = new ThreadLocal<>();
|
||||
|
||||
private List<Decorator> decorators = new ArrayList<>();
|
||||
|
||||
public static void associateInfo(Object info)
|
||||
{
|
||||
decoratorInfo.set(info);
|
||||
|
@ -60,6 +58,9 @@ public class DecoratedObjectFactory implements Iterable<Decorator>
|
|||
return decoratorInfo.get();
|
||||
}
|
||||
|
||||
|
||||
private final List<Decorator> decorators = new ArrayList<>();
|
||||
|
||||
public void addDecorator(Decorator decorator)
|
||||
{
|
||||
LOG.debug("Adding Decorator: {}", decorator);
|
||||
|
|
|
@ -2137,8 +2137,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu
|
|||
{
|
||||
try
|
||||
{
|
||||
// TODO object factory!
|
||||
return clazz.getDeclaredConstructor().newInstance();
|
||||
T instance = clazz.getDeclaredConstructor().newInstance();
|
||||
return getCoreContext().decorate(instance);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -173,6 +173,7 @@ public class ServletContextHandler extends ContextHandler
|
|||
_servletHandler = servletHandler;
|
||||
|
||||
_objFactory = new DecoratedObjectFactory();
|
||||
addBean(_objFactory, true);
|
||||
|
||||
// Link the handlers
|
||||
relinkHandlers();
|
||||
|
|
Loading…
Reference in New Issue