public <T extends PipelineContext> T getOrCreateContext(Class<T> type, Function<RenderManager, T> function) {
        T c = getContext(type);
        if (c == null) {
            c = function.apply(this);
            registerContext(type, c);
        }
        return c;
    }
Gets the pipeline context registered under the class or creates
and registers a new context from the function.

@param <T>
@param type
@param function interface for creating a new context if necessary
@return registered or newly created context
jme3-core/src/main/java/com/jme3/renderer/RenderManager.java