@Config(name="B") public static class B { private String name; public B () { } public B (String name) { this.name = name; } public String getName() { return name; } }
/** * Fire a notification for a collection of beans that have been deleted. * * @param beans deleted beans */ public final void fireDelete(List<Bean> beans) { ConfigChanges changes = new ConfigChanges(); for (Bean bean : beans) { changes.add(ConfigChange.deleted(bean)); } fire(changes); }
@Config(name = "CdiSingletonConfig", desc = "A cdi enabled lookup configuration") @ConfigScope public class CdiSingletonConfig { @Config(desc = "value") private String value = "value"; public CdiSingletonConfig() { } public CdiSingletonConfig(String value) { this.value = value; } public String getValue() { return value; } }
/** * Fire a notification for a collection of beans that have been created. * * @param beans created beans */ public final void fireCreate(Collection<Bean> beans) { ConfigChanges changes = new ConfigChanges(); for (Bean bean : beans) { changes.add(ConfigChange.created(bean)); } fire(changes); }
@Config(name = "person", desc = "desc") public static class Person { @Id(desc = "") private String id; @Config(desc = "") private Person bestFriend; @Config(desc = "") private List<Person> closeFriends = new ArrayList<>(); @Config(desc = "") private Map<String, Person> colleauges = new HashMap<>(); public Person(String id) { this.id = id; } public Person() { } }
public void clear() { changes = new ConfigChanges(); }
public <T> Collection<ConfigChange<T>> getChanges(Class<T> cls) { return changes.getChanges(cls); }
public static <T> ConfigChange<T> deleted(T before) { return new ConfigChange(Optional.of(before), Optional.absent()); }
@SuppressWarnings({ "unchecked", "rawtypes" }) private void runtimeAllAndAssert(Class clazz, Object... objects) throws AssertionFailedError { List<Object> reslut = config.list(clazz); assertReflectionEquals(objects, reslut, LENIENT_ORDER); } }
/** * Fire a notification for a collection of beans that have been deleted. * * @param beans deleted beans */ public final void fireDelete(List<Bean> beans) { ConfigChanges changes = new ConfigChanges(); for (Bean bean : beans) { changes.add(ConfigChange.deleted(bean)); } fire(changes); }
/** * Fire a notification for a collection of beans that have been created. * * @param beans created beans */ public final void fireCreate(Collection<Bean> beans) { ConfigChanges changes = new ConfigChanges(); for (Bean bean : beans) { changes.add(ConfigChange.created(bean)); } fire(changes); }
@ConfigScope @Config(name = "cluster", desc = "Server cluster configuration. Changes requires server restart.") public class ClusterConfig { @Config(desc="Server that are configured as members of this cluster.") private List<ServerConfig> servers = new ArrayList<>(); public List<ServerConfig> getServers() { return servers; } public void setServers(List<ServerConfig> servers) { this.servers = servers; } public void addServer(ServerConfig server) { servers.add(server); } }
@Config(name = "jobs", desc = "Configuration for a specific job") public class JobConfig { @Id(desc = "id") private String id; @Config(desc = "Cron expression used for job scheduling.") private String cronExpression; public JobConfig() { } public JobConfig(String id) { this.id = id; } public String getId() { return id; } public String getCronExpression() { return cronExpression; } }
public void clear() { changes = new ConfigChanges(); }
@Config(name="A") public static class A { private String name; public A () { } public A (String name) { this.name = name; } public String getName() { return name; } }
@SuppressWarnings({ "unchecked", "rawtypes" }) private void runtimeAllAndAssert(Class clazz, Object... objects) throws AssertionFailedError { List<Object> reslut = config.list(clazz); assertReflectionEquals(objects, reslut, LENIENT_ORDER); }
@Config(name="datasource") @ConfigScope public class DataSourceConfig { private String password = "westty"; private String user = "westty"; private String driver = "org.apache.derby.jdbc.EmbeddedDriver"; private String url ="jdbc:derby:memory:westty;create=true"; public DataSourceConfig() { } public String getPassword() { return password; } public String getUser() { return user; } public String getDriver() { return driver; } public String getUrl() { return url; } }
@Config(name = SINGLETON_PARENT_SCHEMA_NAME, desc = "") public static class SingletonParent { @Config(desc = "") private Singleton singleton; @Config(desc = "") private String property; public SingletonParent() { } public String getProperty() { return property; } public Singleton getSingleton() { return singleton; } public void setSingleton(Singleton singleton) { this.singleton = singleton; } }
@Config(name = "web", desc = "Static web configuration. Changes requires server restart.") @ConfigScope public class WebConfig { @Config(desc = "URI where static web content is mounted.") @NotNull private String uri = "/"; public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } }
@Config(name = SINGLETON_SCHEMA_NAME, desc = "") public static class Singleton { @Config(desc = "") private String property; @Config(desc="") private Parent parent; public BeanId getBeanId() { return BeanId.createSingleton(SINGLETON_SCHEMA_NAME); } public String getProperty() { return property; } public Parent getParent() { return parent; } public void setProperty(String property) { this.property = property; } }