public T getComponent()

in src/main/java/org/apache/archiva/redback/components/springutils/ComponentContainer.java [73:85]


    public <T> T getComponent( Class<T> clazz )
    {
        Map<String, T> beansOfType = applicationContext.getBeansOfType( clazz );
        if ( beansOfType == null || beansOfType.isEmpty() )
        {
            throw new RuntimeException( "no beans of Type " + clazz.getName() );
        }
        if ( beansOfType.size() > 1 )
        {
            throw new RuntimeException( "not only one beans of Type " + clazz.getName() );
        }
        return beansOfType.values().iterator().next();
    }