use of com.tinkerpop.frames.modules.Module in project frames by tinkerpop.
the class FramedGraphFactory method getConfiguration.
/**
* Returns a configuration that can be used when constructing a framed graph.
* @param requiredType The type of graph required after configuration e.g. {@link TransactionalGraph}
* @param baseGraph The base graph to get a configuration for.
* @return The configuration.
*/
protected <T extends Graph> FramedGraphConfiguration getConfiguration(Class<T> requiredType, T baseGraph) {
Graph configuredGraph = baseGraph;
FramedGraphConfiguration config = getBaseConfig();
for (Module module : modules) {
configuredGraph = module.configure(configuredGraph, config);
if (!(requiredType.isInstance(configuredGraph))) {
throw new UnsupportedOperationException("Module '" + module.getClass() + "' returned a '" + baseGraph.getClass().getName() + "' but factory requires '" + requiredType.getName() + "'");
}
}
config.setConfiguredGraph(configuredGraph);
return config;
}
Aggregations