Search in sources :

Example 1 with AutomatikoConfigProperties

use of io.automatiko.engine.api.codegen.AutomatikoConfigProperties in project automatiko-engine by automatiko-io.

the class AutomatikoConfigSource method getProperties.

@Override
public Map<String, String> getProperties() {
    load();
    Map<String, String> properties = new LinkedHashMap<String, String>();
    if (found == null) {
        return properties;
    }
    for (AutomatikoConfigProperties p : found) {
        if (p.getProperties() != null) {
            properties.putAll(p.getProperties());
        }
    }
    return properties;
}
Also used : AutomatikoConfigProperties(io.automatiko.engine.api.codegen.AutomatikoConfigProperties) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with AutomatikoConfigProperties

use of io.automatiko.engine.api.codegen.AutomatikoConfigProperties in project automatiko-engine by automatiko-io.

the class AutomatikoConfigSource method load.

private void load() {
    if (found == null) {
        try {
            ServiceLoader<AutomatikoConfigProperties> loader = ServiceLoader.load(AutomatikoConfigProperties.class);
            found = StreamSupport.stream(loader.spliterator(), false).collect(Collectors.toList());
            found.add(new AutomatikoConfigProperties() {

                private Map<String, String> values = new LinkedHashMap<>();

                @Override
                public String getProperty(String name) {
                    if ("mp.openapi.extensions.smallrye.operationIdStrategy".equals(name)) {
                        return "METHOD";
                    }
                    return null;
                }

                @Override
                public Map<String, String> getProperties() {
                    if (values.isEmpty()) {
                        values.put("mp.openapi.extensions.smallrye.operationIdStrategy", "METHOD");
                    }
                    return values;
                }
            });
        } catch (Throwable e) {
        }
    }
}
Also used : AutomatikoConfigProperties(io.automatiko.engine.api.codegen.AutomatikoConfigProperties) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

AutomatikoConfigProperties (io.automatiko.engine.api.codegen.AutomatikoConfigProperties)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)1