This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Config(desc="Config class") | |
public class MyClass { | |
@Id(desc="Identification") | |
private String id; | |
@Config(desc="Name is a name") | |
private String name; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.deephacks.tools4j</groupId> | |
<artifactId>config-api-admin</artifactId> | |
<version>0.0.1</version> | |
<scope>compile</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.deephacks.tools4j</groupId> | |
<artifactId>config-core</artifactId> | |
<version>0.0.1</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>org.deephacks.tools4j</groupId> | |
<artifactId>config-api-runtime</artifactId> | |
<version>0.0.1</version> | |
<scope>compile</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.deephacks.tools4j</groupId> | |
<artifactId>config-core</artifactId> | |
<version>0.0.1</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RuntimeContext runtime = Lookup.get().lookup(RuntimeContext.class); | |
runtime.register(Database.class); | |
List<Database> tests = runtime.all(Database.class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AdminContext admin = Lookup.get().lookup(AdminContext.class); | |
Bean bean = Bean.create(BeanId.create("user", Database.class.getName())); | |
bean.addProperty("url", "/dev/null"); | |
bean.addProperty("username", "admin"); | |
bean.addProperty("password", "admin123"); | |
bean.addProperty("poolSize", "nonsense"); | |
admin.create(bean); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Database user = runtime.get("user", Database.class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Config(desc = "User database.") | |
public class Database { | |
@Id(desc = "Identification of database.") | |
private String id; | |
@Config(desc = "Address for connecting to database.") | |
private URL url; | |
// username with default value 'test' | |
@Config(desc = "Username for connecting to database.") | |
private String username = "test"; | |
// password with default value 'test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.validation.Constraint; | |
import javax.validation.ConstraintValidator; | |
import javax.validation.ConstraintValidatorContext; | |
import javax.validation.Payload; | |
import javax.validation.constraints.Min; | |
import javax.validation.constraints.NotNull; | |
@Config(desc = "A binary tree") | |
@BinaryTreeConstraint | |
public class BinaryTree { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1, 2, 3 is easy | |
List<Integer> counting = Arrays.asList(1, 2, 3); | |
// mathematical variable | |
Double x; | |
// measuring performance | |
TimeUnit precision = TimeUnit.NANOSECONDS; | |
// 5:01 developers | |
Set<Day> working = new HashSet<Day>(Arrays.asList(MON, TUE, WED, THU, FRI)); | |
// content tags | |
List<String> labels; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupId>javax.validation</groupId> | |
<artifactId>validation-api</artifactId> | |
<version>1.0.0.GA</version> | |
<scope>compile</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.hibernate</groupId> | |
<artifactId>hibernate-validator</artifactId> | |
<version>4.1.0.Final</version> |
OlderNewer