Package javax.json

Examples of javax.json.JsonArray

    public final void createsMkCommit() throws Exception {
        final JsonObject author = Json.createObjectBuilder()
            .add("name", "Scott").add("email", "")
            .add("date", "2008-07-09T16:13:30+12:00").build();
        final JsonArray tree = Json.createArrayBuilder()
        final Commit newCommit = this.repo().git().commits().create(
            Json.createObjectBuilder().add("message", "my commit message")
                .add("sha", "12ahscba")
                .add("tree", "abcsha12")
View Full Code Here

    @NotNull(message = "created tree is never NULL")
    public Tree create(
        @NotNull(message = "params can't be NULL") final JsonObject params
    ) throws IOException {
        final JsonArray trees = params.getJsonArray("tree");
        for (final JsonValue val : trees) {
            final JsonObject tree = (JsonObject) val;
            final String sha = tree.getString("sha");
            final Directives dirs = new Directives().xpath(this.xpath())
            for (final Entry<String, JsonValue> entry : tree.entrySet()) {
            final String ref;
            if (tree.containsValue("name")) {
                ref = tree.getString("name");
            } else {
                ref = sha;
            new MkReferences(, this.self, this.coords).create(
                new StringBuilder("refs/trees/").append(ref).toString(),
        return this.get(trees.getJsonObject(0).getString("sha"));
View Full Code Here

         * @return Commits
         * @throws IOException If there is any I/O problem
        @NotNull(message = "Iterable of commits is never NULL")
        public Iterable<RepoCommit> commits() throws IOException {
            final JsonArray array = this.comparison.json()
            final Collection<RepoCommit> commits =
                new ArrayList<RepoCommit>(array.size());
            final RepoCommits repo = this.comparison.repo().commits();
            for (final JsonValue value : array) {
View Full Code Here

            if (link == null) {
                this.more = false;
            } else {
                this.request = response.jump(link.uri());
            final JsonArray arr =
            final Queue<P> list = new LinkedList<P>();
            for (final JsonValue value : arr) {
                list.add((P) value);
View Full Code Here

     * RtContents can iterate through a directory's contents.
     * @throws Exception If something goes wrong.
    public void canIterateDirectoryContents() throws Exception {
        final JsonArray body = Json.createArrayBuilder().add(
                .add("path", "")
                .add("path", ".gitignore")
        final MkContainer container = new MkGrizzlyContainer().next(
            new MkAnswer.Simple(HttpURLConnection.HTTP_OK, body.toString())
        ).next(new MkAnswer.Simple("{\"path\":\"\"}"))
            .next(new MkAnswer.Simple("{\"path\":\".gitignore\"}"))
        final RtContents contents = new RtContents(
            new ApacheRequest(container.home()),
View Full Code Here

      String filename = outputdir + "/patterns" + ".json";

      JsonArrayBuilder obj = Json.createArrayBuilder();
      if (writtenPatInJustification.containsKey(label) && writtenPatInJustification.get(label)) {
        JsonReader jsonReader = Json.createReader(new BufferedInputStream(new FileInputStream(filename)));
        JsonArray objarr = jsonReader.readArray();
        for (JsonValue o : objarr)
      } else
        obj = Json.createArrayBuilder();
View Full Code Here

        JsonArrayBuilder obj = Json.createArrayBuilder();
        if (writtenInJustification.containsKey(label)
            && writtenInJustification.get(label)) {
          JsonReader jsonReader = Json.createReader(new BufferedInputStream(
              new FileInputStream(filename)));
          JsonArray objarr = jsonReader.readArray();
          for (JsonValue o : objarr)

View Full Code Here

  public void testCase01() throws Exception {
    System.out.println("*** testCase01");
    try (JsonReader reader = Json.createReader(new FileReader("src/test/resources/case01.txt"))) {
      JsonArray arr = reader.readArray();
      System.out.println("Version 1 of items iteration");
      for (int i = 0; i < arr.size(); i++) {
        System.out.printf("Value[%s]=%s\n", i, arr.getString(i));
      System.out.println("Version 2 of items iteration");
      for (JsonValue v : arr) {
        System.out.printf("Value=%s\n", v.toString());
View Full Code Here

   * @throws Exception
  public void testCase03() throws Exception {
    System.out.println("*** testCase03");
    JsonArray arrLibraries = Json.createArrayBuilder().add("Lux City").add("Lux Concorde").build();
    JsonObject obj = Json.createObjectBuilder().add("bookName", "Lord of the Rings").add("priceInEuro", 25).add("libraries", arrLibraries).build();
    File f = new File("target/case03.txt");
    try (JsonWriter jsonWriter = Json.createWriter(new FileOutputStream(f, false))) {
      System.out.printf("File saved to %s.\n", f.getAbsolutePath());
View Full Code Here

      for (String name : object.keySet())
        navigateTree(object.get(name), name);
    case ARRAY:
      JsonArray array = (JsonArray) tree;
      for (JsonValue val : array)
        navigateTree(val, null);
    case STRING:
      JsonString st = (JsonString) tree;
View Full Code Here


Related Classes of javax.json.JsonArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact