org.apache.commons.inject.api
Class AbstractLoggerInjectingModule<Log>

java.lang.Object
  extended by org.apache.commons.inject.api.AbstractLoggerInjectingModule<Log>
All Implemented Interfaces:
IModule
Direct Known Subclasses:
CommonsLoggingLoggerModule, Log4j2LoggerModule, Log4jLoggerModule, Slf4JLoggerModule

public abstract class AbstractLoggerInjectingModule<Log>
extends Object
implements IModule

Abstract implementation of a module, which injects loggers into fields. The field must be annotated like this:


Constructor Summary
AbstractLoggerInjectingModule()
           
 
Method Summary
 void configure(IBinder pBinder)
          Called by the IInjectorBuilder to create bindings, by using the given binder.
protected  Class<? extends Annotation> getAnnotationClass()
          Returns the annotation class, which denotes suitable target fields.
protected  String getId(Annotation pAnnotation, Class<?> pClass)
          Called to calculate the Id, which is used to invoke newLogger(String).
protected abstract  Log newLogger(String pId)
          Creates a new logger with the given Id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLoggerInjectingModule

public AbstractLoggerInjectingModule()
Method Detail

configure

public void configure(IBinder pBinder)
Description copied from interface: IModule
Called by the IInjectorBuilder to create bindings, by using the given binder.

Specified by:
configure in interface IModule

newLogger

protected abstract Log newLogger(String pId)
Creates a new logger with the given Id. Subclasses must overwrite this to return a suitable logger implementation.


getAnnotationClass

protected Class<? extends Annotation> getAnnotationClass()
Returns the annotation class, which denotes suitable target fields. By default, the class InjLogger is used.


getId

protected String getId(Annotation pAnnotation,
                       Class<?> pClass)
Called to calculate the Id, which is used to invoke newLogger(String). By default, InjLogger#name() is returned.



Copyright © 2014 The Apache Software Foundation. All Rights Reserved.