Search in sources :

Example 1 with GraphConfiguration

use of org.eclipse.jnosql.mapping.graph.GraphConfiguration in project jnosql-diana by eclipse.

the class GraphConverter method success.

@Override
protected Graph success(String value) {
    final SettingsConverter settingsConverter = BeanManagers.getInstance(SettingsConverter.class);
    Config config = BeanManagers.getInstance(Config.class);
    final Settings settings = settingsConverter.convert(value);
    final String provider = value + ".provider";
    final Class<?> configurationClass = config.getValue(provider, Class.class);
    if (GraphConfiguration.class.isAssignableFrom(configurationClass)) {
        final Reflections reflections = BeanManagers.getInstance(Reflections.class);
        final GraphConfiguration configuration = (GraphConfiguration) reflections.newInstance(configurationClass);
        return configuration.apply(settings);
    }
    throw new ConfigurationException("The class " + configurationClass + " is not valid to " + GraphConfiguration.class);
}
Also used : GraphConfiguration(org.eclipse.jnosql.mapping.graph.GraphConfiguration) SettingsConverter(org.eclipse.jnosql.mapping.configuration.SettingsConverter) ConfigurationException(org.eclipse.jnosql.mapping.configuration.ConfigurationException) Config(org.eclipse.microprofile.config.Config) Settings(jakarta.nosql.Settings) Reflections(org.eclipse.jnosql.mapping.reflection.Reflections)

Aggregations

Settings (jakarta.nosql.Settings)1 ConfigurationException (org.eclipse.jnosql.mapping.configuration.ConfigurationException)1 SettingsConverter (org.eclipse.jnosql.mapping.configuration.SettingsConverter)1 GraphConfiguration (org.eclipse.jnosql.mapping.graph.GraphConfiguration)1 Reflections (org.eclipse.jnosql.mapping.reflection.Reflections)1 Config (org.eclipse.microprofile.config.Config)1