Package javax.json.stream

Examples of javax.json.stream.JsonGenerator.writeStartArray()


            if (null != record.getSourceMethodName()) {
                json.write(JSON_KEY_SOURCE_METHOD, record.getSourceMethodName());
            }

            if (!tags.isEmpty()) {
                json.writeStartArray("tags");
                for (String tag: tags) {
                    json.write(tag);
                }
                json.writeEnd();
            }
View Full Code Here


            gen.flush();
            out.println("<br>...done<br>");

            out.println("<br>Creating a simple array ...<br>");
            gen = factory.createGenerator(out);
            gen
                    .writeStartArray()
                    .writeStartObject()
                    .write("apple", "red")
                    .writeEnd()
                    .writeStartObject()
View Full Code Here

    public void testArray() throws JSONException {
        JsonGeneratorFactory factory = Json.createGeneratorFactory(null);
        StringWriter w = new StringWriter();
        JsonGenerator gen = factory.createGenerator(w);

        gen
                .writeStartArray()
                .writeStartObject()
                .write("apple", "red")
                .writeEnd()
                .writeStartObject()
View Full Code Here

    writeOptionalTagWithTextNode(eventWriter, "totalResults", theBundle.getTotalResults());

    writeAuthor(theBundle, eventWriter);

    eventWriter.writeStartArray("entry");
    for (BundleEntry nextEntry : theBundle.getEntries()) {
      eventWriter.writeStartObject();

      if (nextEntry.getDeletedAt() !=null&&nextEntry.getDeletedAt().isEmpty()==false) {
        writeTagWithTextNode(eventWriter, "deleted", nextEntry.getDeletedAt());
View Full Code Here

      writeOptionalTagWithTextNode(eventWriter, "updated", nextEntry.getUpdated());
      writeOptionalTagWithTextNode(eventWriter, "published", nextEntry.getPublished());

      if (nextEntry.getCategories() != null && nextEntry.getCategories().size() > 0) {
        eventWriter.writeStartArray("category");
        for (Tag next : nextEntry.getCategories()) {
          eventWriter.writeStartObject();
          eventWriter.write("term", defaultString(next.getTerm()));
          eventWriter.write("label", defaultString(next.getLabel()));
          eventWriter.write("scheme", defaultString(next.getScheme()));
View Full Code Here

    eventWriter.writeStartObject();

    eventWriter.write("resourceType", TagList.ELEMENT_NAME);

    eventWriter.writeStartArray(TagList.ATTR_CATEGORY);
    for (Tag next : theTagList) {
      eventWriter.writeStartObject();

      if (isNotBlank(next.getTerm())) {
        eventWriter.write(Tag.ATTR_TERM, next.getTerm());
View Full Code Here

    writeOptionalTagWithTextNode(eventWriter, "totalResults", theBundle.getTotalResults());

    writeAuthor(theBundle, eventWriter);

    eventWriter.writeStartArray("entry");
    for (BundleEntry nextEntry : theBundle.getEntries()) {
      eventWriter.writeStartObject();

      boolean deleted = nextEntry.getDeletedAt() != null && nextEntry.getDeletedAt().isEmpty() == false;
      if (deleted) {
View Full Code Here

    eventWriter.writeStartObject();

    eventWriter.write("resourceType", TagList.ELEMENT_NAME);

    eventWriter.writeStartArray(TagList.ATTR_CATEGORY);
    for (Tag next : theTagList) {
      eventWriter.writeStartObject();

      if (isNotBlank(next.getTerm())) {
        eventWriter.write(Tag.ATTR_TERM, next.getTerm());
View Full Code Here

    writeTagWithTextNode(eventWriter, "title", theBundle.getTitle());
    writeTagWithTextNode(eventWriter, "id", theBundle.getBundleId());
    writeOptionalTagWithTextNode(eventWriter, "updated", theBundle.getUpdated());
    writeOptionalTagWithTextNode(eventWriter, "published", theBundle.getPublished());

    eventWriter.writeStartArray("link");
    writeAtomLink(eventWriter, "self", theBundle.getLinkSelf());
    writeAtomLink(eventWriter, "first", theBundle.getLinkFirst());
    writeAtomLink(eventWriter, "previous", theBundle.getLinkPrevious());
    writeAtomLink(eventWriter, "next", theBundle.getLinkNext());
    writeAtomLink(eventWriter, "last", theBundle.getLinkLast());
View Full Code Here

    writeOptionalTagWithTextNode(eventWriter, "totalResults", theBundle.getTotalResults());

    writeAuthor(theBundle, eventWriter);

    eventWriter.writeStartArray("entry");
    for (BundleEntry nextEntry : theBundle.getEntries()) {
      eventWriter.writeStartObject();

      writeTagWithTextNode(eventWriter, "title", nextEntry.getTitle());
      writeTagWithTextNode(eventWriter, "id", nextEntry.getId());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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 coftware#gmail.com.