Skip to content

java-tilt is a Java based language binding for the Transparency Information Language and Toolkit.

License

Notifications You must be signed in to change notification settings

Transparency-Information-Language/java-tilt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java CI with Maven Maven Package

java-tilt

java-tilt is a Java based language binding for the Transparency Information Language and Toolkit.

Installation

1/2: Add this to pom.xml:

<dependency>
  <groupId>cloud.implementation.tilt</groupId>
  <artifactId>tilt</artifactId>
  <version>0.0.1</version>
</dependency>

2/2: Run via command line:

$ mvn install

Usage

See more examples and tests here.

/*
    Generate new Tilt instance from scratch
 */

Tilt tilt = new Tilt();

Controller controller = new Controller();
controller.setName("Example Company SE");
tilt.setController(controller);

System.out.println(tilt.toString());
/*
    Validation Example
*/

String DOCUMENT_URL = "https://raw.githubusercontent.com/Transparency-Information-Language/schema/master/tilt.json";

TiltValidator.validateDocumentFromUrl(DOCUMENT_URL);
/*
    Load tilt instance from json and modify properties
*/
try {
    String instance = IOUtils.toString(URI.create(DOCUMENT_URL), "utf8");

    System.out.println(instance.indexOf("meta"));

    Tilt t = Converter.fromJsonString(instance);
    System.out.println(t.getMeta().getHash());
    t.getMeta().setHash("42");

    System.out.println(Converter.toJsonString(t));

    System.out.println(t.getMeta().toString());
    System.out.println(t.toString());

} catch (IOException e) {
    e.printStackTrace();
}

Author

Elias Grünewald

License

MIT License