Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonGenerator.writeStartObject()


  private byte[] getStorageJSON() {
    // 256 bytes is a good starting value, assumes default info
    final ByteArrayOutputStream output = new ByteArrayOutputStream(256);
    try {
      final JsonGenerator json = JSON.getFactory().createGenerator(output);
      json.writeStartObject();
      json.writeStringField("uid", uid);
      json.writeStringField("type", type.toString());
      json.writeStringField("name", name);
      json.writeStringField("displayName", display_name);
      json.writeStringField("description", description);
View Full Code Here


    final ByteArrayOutputStream output = new ByteArrayOutputStream(
        display_name.length() + tsuid.length() + 30);
    try {
      final JsonGenerator json = JSON.getFactory().createGenerator(output);
     
      json.writeStartObject();
     
      // we only need to write a small amount of information
      json.writeObjectField("displayName", display_name);
      json.writeObjectField("tsuid", tsuid);
     
View Full Code Here

     */
    private static String toJSON(BucketProperties bp) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        JsonGenerator jg = new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8);

        jg.writeStartObject();
        writeIfNotNull(jg, bp.getAllowSiblings(), Constants.FL_SCHEMA_ALLOW_MULT);
        writeIfNotNull(jg, bp.getNVal(), Constants.FL_SCHEMA_NVAL);
        writeIfNotNull(jg, bp.getLastWriteWins(), Constants.FL_SCHEMA_LAST_WRITE_WINS);
        writeIfNotNull(jg, bp.getBackend(), Constants.FL_SCHEMA_BACKEND);
        writeIfNotNull(jg, bp.getSmallVClock(), Constants.FL_SCHEMA_SMALL_VCLOCK);
View Full Code Here

        try {
            JsonGenerator jg = new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8);
            jg.setCodec(new ObjectMapper());

            jg.writeStartObject();

            jg.writeFieldName("inputs");
            writeInput(jg);

            jg.writeFieldName("query");
View Full Code Here

        JsonFactory factory = new JsonFactory();
        try {
            JsonGenerator generator = factory.createJsonGenerator(outputFile, JsonEncoding.UTF8);
            generator.setPrettyPrinter(new DefaultPrettyPrinter());
            try {
                generator.writeStartObject();
                generator.writeStringField("previousVersion", previousVersion);
                generator.writeFieldName("dependencies");
                writeDependenciesDelta(addedDeps, removedDeps, updatedDeps, unchangedDeps, generator);
                if (changeLog != null) {
                    generator.writeFieldName("scm");
View Full Code Here

      JsonGenerator gen = jfactory.createJsonGenerator(sw);
     
      Method getEnumDescription= en.getMethod("getEnumDescription");
      if (getEnumDescription!=null  && getEnumDescription.getReturnType()==String.class && Modifier.isStatic(getEnumDescription.getModifiers()))
          enumDescription=(String) getEnumDescription.invoke(null);
      gen.writeStartObject();                                            //{
      gen.writeStringField("section", section);                          //   "configuration":"EnumName"
      gen.writeStringField("description", enumDescription);                            //  ,"description": "EnumDescription"
      gen.writeFieldName("sub sections");                                        //  ,"sections":
      gen.writeStartObject();                                            //    {
      String lastSection = "";
View Full Code Here

          enumDescription=(String) getEnumDescription.invoke(null);
      gen.writeStartObject();                                            //{
      gen.writeStringField("section", section);                          //   "configuration":"EnumName"
      gen.writeStringField("description", enumDescription);                            //  ,"description": "EnumDescription"
      gen.writeFieldName("sub sections");                                        //  ,"sections":
      gen.writeStartObject();                                            //    {
      String lastSection = "";
      EnumSet values = EnumSet.allOf( en );
      for (Object v : values) {
          String key=(String) (en.getMethod("getKey")).invoke(v);
          boolean isVisible=(Boolean)(en.getMethod("isVisible")).invoke(v);
View Full Code Here

              gen.writeFieldName(subsection);                                    //      "sectionName":
              gen.writeStartArray();                                        //        [
              lastSection = subsection;
           
            boolean isOverridden = (Boolean)(en.getMethod("isOverridden")).invoke(v);
            gen.writeStartObject();                                        //          {
            gen.writeStringField(key,valueAsString);                              //              "key": "value" 
            gen.writeStringField("description", valueDescription);                        //            ,"description":"description"
            gen.writeStringField("type",type.getSimpleName());                          //            ,"type":"type"
            gen.writeBooleanField("editable",isEditable);                          //            ,"editable":"true|false"
            gen.writeBooleanField("visible",isVisible);                          //            ,"visible":"true|false"
View Full Code Here

          boolean isEditable=(Boolean)(en.getMethod("isEditable")).invoke(v);
            boolean isOverridden = (Boolean)(en.getMethod("isOverridden")).invoke(v);
          String valueDescription=(String) (en.getMethod("getValueDescription")).invoke(v);
          Class type = (Class) en.getMethod("getType").invoke(v);
         
            gen.writeStartObject();                                        //          {
            gen.writeStringField("key", key)
            gen.writeStringField("value",valueAsString);
            gen.writeStringField("description", valueDescription);                        //            ,"description":"description"
            gen.writeStringField("type",type.getSimpleName());                          //            ,"type":"type"
            gen.writeBooleanField("editable", isEditable);
View Full Code Here

      JsonGenerator json = JSON.getFactory().createGenerator(output);
      json.writeStartArray();
     
      for (DataPoints[] separate_dps : results) {
        for (DataPoints dps : separate_dps) {
          json.writeStartObject();
         
          json.writeStringField("metric", dps.metricName());
         
          json.writeFieldName("tags");
          json.writeStartObject();
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.