@Test public void storeTo() { Properties prop = new Properties(); prop.setProperty("mock1", MockService.class.getName()); ClassLoader cl = getClass().getClassLoader(); ServiceProfile<Service> service = ServiceProfile.load(prop, "mock1", Service.class, ProfileContext.system(cl)); Properties target = new Properties(); service.storeTo(target); assertThat(target, is(prop)); }
public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } properties.setProperty(prefix, getServiceClass().getName()); for (Map.Entry<String, String> entry : getConfiguration().entrySet()) { properties.setProperty(prefix + '.' + entry.getKey(), entry.getValue()); } }
ServiceProfile { public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } properties.setProperty(prefix, getServiceClass().getName()); for (Map.Entry<String, String> entry : getConfiguration().entrySet()) { properties.setProperty(prefix + '.' + entry.getKey(), entry.getValue()); } } }
ServiceProfile { public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } properties.setProperty(prefix, getServiceClass().getName()); for (Map.Entry<String, String> entry : getConfiguration().entrySet()) { properties.setProperty(prefix + '.' + entry.getKey(), entry.getValue()); } } ServiceProfile(
            String prefix,
            Class<? extends T> serviceClass,
            Map<String, String> configuration,
            ProfileContext context); }
ServiceProfile { public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } properties.setProperty(prefix, getServiceClass().getName()); for (Map.Entry<String, String> entry : getConfiguration().entrySet()) { properties.setProperty(prefix + '.' + entry.getKey(), entry.getValue()); } } ServiceProfile(
            String prefix,
            Class<? extends T> serviceClass,
            Map<String, String> configuration,
            ProfileContext context); String getPrefix(); Class<? extends T> getServiceClass(); Map<String, String> getConfiguration(); String getConfiguration(String key, boolean mandatory, boolean resolve); String normalize(String key, String value, boolean mandatory, boolean resolve); ProfileContext getContext(); @Deprecated ClassLoader getClassLoader(); T newInstance(); @Deprecated T newInstance(VariableResolver variables); @Deprecated static ServiceProfile<T> load(
            Properties properties,
            String prefix,
            Class<T> serviceBaseClass,
            ClassLoader classLoader); static ServiceProfile<T> load(
            Properties properties,
            String prefix,
            Class<T> serviceBaseClass,
            ProfileContext context); void storeTo(Properties properties); }
ServiceProfile { public void storeTo(Properties properties) { if (properties == null) { throw new IllegalArgumentException("properties must not be null"); } properties.setProperty(prefix, getServiceClass().getName()); for (Map.Entry<String, String> entry : getConfiguration().entrySet()) { properties.setProperty(prefix + '.' + entry.getKey(), entry.getValue()); } } ServiceProfile(
            String prefix,
            Class<? extends T> serviceClass,
            Map<String, String> configuration,
            ProfileContext context); String getPrefix(); Class<? extends T> getServiceClass(); Map<String, String> getConfiguration(); String getConfiguration(String key, boolean mandatory, boolean resolve); String normalize(String key, String value, boolean mandatory, boolean resolve); ProfileContext getContext(); @Deprecated ClassLoader getClassLoader(); T newInstance(); @Deprecated T newInstance(VariableResolver variables); @Deprecated static ServiceProfile<T> load(
            Properties properties,
            String prefix,
            Class<T> serviceBaseClass,
            ClassLoader classLoader); static ServiceProfile<T> load(
            Properties properties,
            String prefix,
            Class<T> serviceBaseClass,
            ProfileContext context); void storeTo(Properties properties);  }