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
public class Tests { | |
static Path dir = Paths.get("/tmp/test"); | |
static Database test; | |
static Env env; | |
static { | |
try { | |
FileUtils.deleteIfExist(dir); | |
Files.createDirectory(dir); | |
} catch (IOException e) { |
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
public class Test { | |
public static class ArrayListWrapper { | |
int id; | |
ArrayList<Integer> list = new ArrayList<>(); | |
public ArrayListWrapper(int id) { | |
this.id = id; | |
} | |
public void add(int i) { |
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
<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
@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
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 { |
OlderNewer