Examples of JsonGenerator


Examples of com.cedarsoft.serialization.generator.common.output.serializer.test.JsonGenerator

    }

    @Nonnull
    @Override
    protected com.cedarsoft.serialization.generator.common.output.serializer.test.AbstractGenerator<XmlDecisionCallback> instantiateTestGenerator( @Nonnull CodeGenerator testCodeGenerator ) {
      return new JsonGenerator( testCodeGenerator );
    }
View Full Code Here

Examples of com.cedarsoft.serialization.generator.output.serializer.test.JsonGenerator

    }

    @Nonnull
    @Override
    protected com.cedarsoft.serialization.generator.output.serializer.test.AbstractGenerator<XmlDecisionCallback> instantiateTestGenerator( @Nonnull CodeGenerator testCodeGenerator ) {
      return new JsonGenerator( testCodeGenerator );
    }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonGenerator

    }

    public String toString(){
        StringWriter stringWriter = new StringWriter();
        try {
            JsonGenerator jsonGenerator = new JsonFactory().createGenerator(stringWriter);
            if(solution == null) writeProblem(jsonGenerator);
            else writeSolution(jsonGenerator);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonGenerator



    public void write(File jsonFile){
        try {
            JsonGenerator jsonGenerator = new JsonFactory().createGenerator(new FileOutputStream(jsonFile), JsonEncoding.UTF8);
            if(solution == null) writeProblem(jsonGenerator);
            else writeSolution(jsonGenerator);
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonGenerator

            json.writeEndObject();
        }

        @Override
        public void processGauge(MetricName name, Gauge<?> gauge, Context context) throws Exception {
            final JsonGenerator json = context.json;
            json.writeStartObject();
            {
                json.writeStringField("type", "gauge");
                json.writeObjectField("value", evaluateGauge(gauge));
            }
            json.writeEndObject();
        }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonGenerator

        response().setContentType("application/json");
        response().setHeader("Cache-Control", "must-revalidate,no-cache,no-store");

        StringWriter writer = new StringWriter();
        JsonFactory factory = new JsonFactory(new ObjectMapper());
        final JsonGenerator json = factory.createGenerator(writer);
        if (pretty) {
            json.useDefaultPrettyPrinter();
        }
        json.writeStartObject();
        {
            if (("jvm".equals(classPrefix) || Strings.isNullOrEmpty(classPrefix))) {
                writeVmMetrics(json);
            }

            ServerMetrics metricProcessor = new ServerMetrics();
            writeRegularMetrics(json, classPrefix, metricProcessor);
        }
        json.writeEndObject();
        json.close();

        return ok(writer.toString());
    }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonGenerator

    }

    public static class ServerMetrics implements MetricProcessor<Context> {
        @Override
        public void processMeter(MetricName name, Metered meter, Context context) throws Exception {
            final JsonGenerator json = context.json;
            json.writeStartObject();
            {
                json.writeStringField("type", "meter");
                json.writeStringField("event_type", meter.eventType());
                writeMeteredFields(meter, json);
            }
            json.writeEndObject();
        }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonGenerator

            json.writeEndObject();
        }

        @Override
        public void processCounter(MetricName name, Counter counter, Context context) throws Exception {
            final JsonGenerator json = context.json;
            json.writeStartObject();
            {
                json.writeStringField("type", "counter");
                json.writeNumberField("count", counter.count());
            }
            json.writeEndObject();
        }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonGenerator

            json.writeEndObject();
        }

        @Override
        public void processHistogram(MetricName name, Histogram histogram, Context context) throws Exception {
            final JsonGenerator json = context.json;
            json.writeStartObject();
            {
                json.writeStringField("type", "histogram");
                json.writeNumberField("count", histogram.count());
                writeSummarizable(histogram, json);
                writeSampling(histogram, json);

                if (context.showFullSamples) {
                    json.writeObjectField("values", histogram.getSnapshot().getValues());
                }
            }
            json.writeEndObject();
        }
View Full Code Here

Examples of com.fasterxml.jackson.core.JsonGenerator

            }
        }

        @Override
        public void processTimer(MetricName name, Timer timer, Context context) throws Exception {
            final JsonGenerator json = context.json;
            json.writeStartObject();
            {
                json.writeStringField("type", "timer");
                json.writeFieldName("duration");
                json.writeStartObject();
                {
                    json.writeStringField("unit", timer.durationUnit().toString().toLowerCase());
                    writeSummarizable(timer, json);
                    writeSampling(timer, json);
                    if (context.showFullSamples) {
                        json.writeObjectField("values", timer.getSnapshot().getValues());
                    }
                }
                json.writeEndObject();

                json.writeFieldName("rate");
                json.writeStartObject();
                {
                    writeMeteredFields(timer, json);
                }
                json.writeEndObject();
            }
            json.writeEndObject();
        }
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.