@Test public void testConfigurationWithNoPrefix() { MapConfig config = new MapConfig(Collections.singletonMap("string", "HELLO")); assertThat(Archaius2Ext.newConfiguration(MyConfig.class, config).getString()).isEqualTo("HELLO"); }
public static <C> C newConfiguration(Class<C> configType, String... keyValuePairs) { if (keyValuePairs.length == 0) { return DEFAULT_CONFIG_PROXY_FACTORY.newProxy(configType); } Preconditions.checkArgument(keyValuePairs.length % 2 == 0, "Expected even number of arguments"); Map<String, String> props = new HashMap<>(); int len = keyValuePairs.length / 2; for (int i = 0; i < len; i++) { props.put(keyValuePairs[i * 2], keyValuePairs[i * 2 + 1]); } Config config = new MapConfig(props); return newConfiguration(configType, config); }
Archaius2Ext { public static <C> C newConfiguration(Class<C> configType, String... keyValuePairs) { if (keyValuePairs.length == 0) { return DEFAULT_CONFIG_PROXY_FACTORY.newProxy(configType); } Preconditions.checkArgument(keyValuePairs.length % 2 == 0, "Expected even number of arguments"); Map<String, String> props = new HashMap<>(); int len = keyValuePairs.length / 2; for (int i = 0; i < len; i++) { props.put(keyValuePairs[i * 2], keyValuePairs[i * 2 + 1]); } Config config = new MapConfig(props); return newConfiguration(configType, config); } }
Archaius2Ext { public static <C> C newConfiguration(Class<C> configType, String... keyValuePairs) { if (keyValuePairs.length == 0) { return DEFAULT_CONFIG_PROXY_FACTORY.newProxy(configType); } Preconditions.checkArgument(keyValuePairs.length % 2 == 0, "Expected even number of arguments"); Map<String, String> props = new HashMap<>(); int len = keyValuePairs.length / 2; for (int i = 0; i < len; i++) { props.put(keyValuePairs[i * 2], keyValuePairs[i * 2 + 1]); } Config config = new MapConfig(props); return newConfiguration(configType, config); }  }
Archaius2Ext { public static <C> C newConfiguration(Class<C> configType, String... keyValuePairs) { if (keyValuePairs.length == 0) { return DEFAULT_CONFIG_PROXY_FACTORY.newProxy(configType); } Preconditions.checkArgument(keyValuePairs.length % 2 == 0, "Expected even number of arguments"); Map<String, String> props = new HashMap<>(); int len = keyValuePairs.length / 2; for (int i = 0; i < len; i++) { props.put(keyValuePairs[i * 2], keyValuePairs[i * 2 + 1]); } Config config = new MapConfig(props); return newConfiguration(configType, config); }  static Supplier<List<Duration>> asDurationList(Supplier<String> configSupplier); static Flux<T> watch(Property<T> property); static Flux<T> watch(PropertyRepository propertyRepository, String key, Class<T> type); static C newConfiguration(Class<C> configType, String... keyValuePairs); static C newConfiguration(Class<C> configType, Map<String, String> properties); static C newConfiguration(Class<C> configType, Config config); static C newConfiguration(Class<C> configType, String prefix, Config config); static C newConfiguration(Class<C> configType, Environment environment); static C newConfiguration(Class<C> configType, String prefix, Environment environment); static ObjectConfigurationResolver<OBJECT, CONFIG> newObjectConfigurationResolver(
            Config configuration,
            Function<OBJECT, String> selectorFieldAccessor,
            Class<CONFIG> configType,
            CONFIG defaultConfig); static CloseableReference<ObjectConfigurationResolver<OBJECT, CONFIG>> newObjectConfigurationResolver(
            String prefix,
            Environment environment,
            Function<OBJECT, String> selectorFieldAccessor,
            Class<CONFIG> configType,
            CONFIG defaultConfig,
            Flux<Long> updateTrigger); static String toString(Config config); }
Archaius2Ext { public static <C> C newConfiguration(Class<C> configType, String... keyValuePairs) { if (keyValuePairs.length == 0) { return DEFAULT_CONFIG_PROXY_FACTORY.newProxy(configType); } Preconditions.checkArgument(keyValuePairs.length % 2 == 0, "Expected even number of arguments"); Map<String, String> props = new HashMap<>(); int len = keyValuePairs.length / 2; for (int i = 0; i < len; i++) { props.put(keyValuePairs[i * 2], keyValuePairs[i * 2 + 1]); } Config config = new MapConfig(props); return newConfiguration(configType, config); }  static Supplier<List<Duration>> asDurationList(Supplier<String> configSupplier); static Flux<T> watch(Property<T> property); static Flux<T> watch(PropertyRepository propertyRepository, String key, Class<T> type); static C newConfiguration(Class<C> configType, String... keyValuePairs); static C newConfiguration(Class<C> configType, Map<String, String> properties); static C newConfiguration(Class<C> configType, Config config); static C newConfiguration(Class<C> configType, String prefix, Config config); static C newConfiguration(Class<C> configType, Environment environment); static C newConfiguration(Class<C> configType, String prefix, Environment environment); static ObjectConfigurationResolver<OBJECT, CONFIG> newObjectConfigurationResolver(
            Config configuration,
            Function<OBJECT, String> selectorFieldAccessor,
            Class<CONFIG> configType,
            CONFIG defaultConfig); static CloseableReference<ObjectConfigurationResolver<OBJECT, CONFIG>> newObjectConfigurationResolver(
            String prefix,
            Environment environment,
            Function<OBJECT, String> selectorFieldAccessor,
            Class<CONFIG> configType,
            CONFIG defaultConfig,
            Flux<Long> updateTrigger); static String toString(Config config);  }