List of usage examples for com.fasterxml.jackson.core JsonGenerator writeEndArray
public abstract void writeEndArray() throws IOException, JsonGenerationException;
From source file:com.google.openrtb.json.OpenRtbJsonUtils.java
/** * Writes a enum array if not empty.// w ww . ja v a2s. co m * * @see #writeEnum(ProtocolMessageEnum, JsonGenerator) */ public static void writeEnums(String fieldName, List<? extends ProtocolMessageEnum> enums, JsonGenerator gen) throws IOException { if (!enums.isEmpty()) { gen.writeArrayFieldStart(fieldName); for (ProtocolMessageEnum e : enums) { writeEnum(e, gen); } gen.writeEndArray(); } }
From source file:com.netflix.hystrix.contrib.requests.stream.HystrixRequestEventsJsonStream.java
private static void writeRequestAsJson(JsonGenerator json, HystrixRequestEvents request) throws IOException { json.writeStartArray();/*w ww .j a v a 2 s .co m*/ for (Map.Entry<HystrixRequestEvents.ExecutionSignature, List<Integer>> entry : request .getExecutionsMappedToLatencies().entrySet()) { convertExecutionToJson(json, entry.getKey(), entry.getValue()); } json.writeEndArray(); }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.organisational.TeamJSON.java
public final static void manyTeams2JSON(HashSet<Team> teams, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();//from ww w .j a v a2 s . c o m jgenerator.writeArrayFieldStart("teams"); Iterator<Team> iter = teams.iterator(); while (iter.hasNext()) { Team current = iter.next(); TeamJSON.team2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.technical.system.OSTypeJSON.java
public final static void manyOSTypes2JSON(HashSet<OSType> osTypes, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();//from w ww. j av a2 s. co m jgenerator.writeArrayFieldStart("osTypes"); Iterator<OSType> iter = osTypes.iterator(); while (iter.hasNext()) { OSType current = iter.next(); OSTypeJSON.osType2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.organisational.CompanyJSON.java
public final static void manyCompanies2JSON(HashSet<Company> companies, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();/*from w w w . j av a 2 s . c o m*/ jgenerator.writeArrayFieldStart("companies"); Iterator<Company> iter = companies.iterator(); while (iter.hasNext()) { Company current = iter.next(); CompanyJSON.company2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:org.ng200.openolympus.controller.auth.AuthenticationResponder.java
public static void writeLoginStatusJson(Writer out, String authMessage, List<String> captchaErrorCodes) throws IOException, JsonGenerationException { final JsonFactory factory = new JsonFactory(); final JsonGenerator generator = factory.createGenerator(out); generator.writeStartObject();//from w ww. j av a 2 s . com generator.writeStringField("auth", authMessage); if (captchaErrorCodes != null && !captchaErrorCodes.isEmpty()) { generator.writeArrayFieldStart("captchas"); for (final String captchaErrorCode : captchaErrorCodes) { generator.writeString(captchaErrorCode); } generator.writeEndArray(); } else { generator.writeNullField("captchas"); } generator.writeEndObject(); generator.close(); }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.technical.network.SubnetJSON.java
public final static void manySubnets2JSON(HashSet<Subnet> subnets, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();//from w w w .j a v a2 s . com jgenerator.writeArrayFieldStart("subnets"); Iterator<Subnet> iter = subnets.iterator(); while (iter.hasNext()) { Subnet current = iter.next(); SubnetJSON.subnet2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.organisational.EnvironmentJSON.java
public final static void manyEnvironments2JSON(HashSet<Environment> environments, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();//from w w w . ja v a 2 s . com jgenerator.writeArrayFieldStart("environments"); Iterator<Environment> iter = environments.iterator(); while (iter.hasNext()) { Environment current = iter.next(); EnvironmentJSON.environment2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.technical.network.RoutingAreaJSON.java
public final static void manyRoutingAreas2JSON(HashSet<RoutingArea> routingAreas, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();/*from w w w . j a va 2s . c o m*/ jgenerator.writeArrayFieldStart("routingAreas"); Iterator<RoutingArea> iter = routingAreas.iterator(); while (iter.hasNext()) { RoutingArea current = iter.next(); RoutingAreaJSON.routingArea2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }
From source file:net.echinopsii.ariane.community.core.directory.wat.json.ds.technical.network.DatacenterJSON.java
public final static void manyDatacenters2JSON(HashSet<Datacenter> datacenters, ByteArrayOutputStream outStream) throws IOException { JsonGenerator jgenerator = DirectoryBootstrap.getjFactory().createGenerator(outStream, JsonEncoding.UTF8); jgenerator.writeStartObject();// w ww .j a v a 2 s . c om jgenerator.writeArrayFieldStart("datacenters"); Iterator<Datacenter> iter = datacenters.iterator(); while (iter.hasNext()) { Datacenter current = iter.next(); DatacenterJSON.datacenter2JSON(current, jgenerator); } jgenerator.writeEndArray(); jgenerator.writeEndObject(); jgenerator.close(); }