001/*****************************************************************************
002 * Copyright (C) PicoContainer Organization. All rights reserved.            *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD      *
005 * style license a copy of which has been included with this distribution in *
006 * the LICENSE.txt file.                                                     *
007 *                                                                           *
008 *****************************************************************************/
009package org.picocontainer.gems.injectors;
010
011import org.picocontainer.injectors.FactoryInjector;
012import org.picocontainer.injectors.InjectInto;
013import org.picocontainer.PicoContainer;
014import org.picocontainer.PicoCompositionException;
015import org.slf4j.Logger;
016import org.slf4j.LoggerFactory;
017
018import java.lang.reflect.Type;
019
020/**
021 * This will Inject a Slf4J Logger for the injectee's class name
022 */
023public class Slf4JInjector extends FactoryInjector<Logger> {
024
025    @Override
026        public Logger getComponentInstance(final PicoContainer container, final Type into) throws PicoCompositionException {
027        return LoggerFactory.getLogger((((InjectInto) into).getIntoClass()).getName());
028    }
029}