private ComponentType getPipelineComponent()

in src/main/java/org/apache/sling/rewriter/impl/PipelineImpl.java [145:165]


    private <ComponentType> ComponentType getPipelineComponent(final Class<ComponentType> typeClass,
                                                               final String type,
                                                               final boolean optional)
    throws IOException {
        final ComponentType component;
        if ( typeClass == Generator.class ) {
            component = (ComponentType)this.factoryCache.getGenerator(type);
        } else if ( typeClass == Transformer.class ) {
            component = (ComponentType)this.factoryCache.getTransformer(type);
        } else if ( typeClass == Serializer.class ) {
            component = (ComponentType)this.factoryCache.getSerializer(type);
        } else {
            component = null;
        }

        if ( component == null && !optional ) {
            throw new IOException("Unable to get component of class '" + typeClass + "' with type '" + type + "'.");
        }

        return component;
    }