@Override public void marshall(Short val, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context, MarshallingInfo<Short> marshallingInfo) { jsonGenerator.writeValue(val); } };
@Override public Request<OrigRequest> finishMarshalling() { // Content may already be set if the payload is binary data. if (request.getContent() == null) { // End the implicit request object if needed. if (!hasExplicitPayloadMember) { jsonGenerator.writeEndObject(); } byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); if (content.length > 0) { request.addHeader("Content-Length", Integer.toString(content.length)); } } if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", contentType); } return request; }
@Override public void marshall(List list, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context, MarshallingInfo<List> marshallingInfo) { jsonGenerator.writeStartArray(); for (Object listValue : list) { context.marshall(MarshallLocation.PAYLOAD, listValue); } jsonGenerator.writeEndArray(); }
@Override public void marshall(Map map, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context, MarshallingInfo<Map> mapMarshallingInfo) { jsonGenerator.writeStartObject(); for (Map.Entry<String, ?> entry : ((Map<String, ?>) map).entrySet()) { if (entry.getValue() != null) { final Object value = entry.getValue(); jsonGenerator.writeFieldName(entry.getKey()); context.marshall(MarshallLocation.PAYLOAD, value); } } jsonGenerator.writeEndObject(); }
@Override public void marshall(StructuredPojo val, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context, MarshallingInfo<StructuredPojo> marshallingInfo) { jsonGenerator.writeStartObject(); val.marshall(context.protocolHandler()); jsonGenerator.writeEndObject(); } };
/** * If there is not an explicit payload member then we need to start the implicit JSON request object. All * members bound to the payload will be added as fields to this object. */ @Override public void startMarshalling() { if (!hasExplicitPayloadMember) { jsonGenerator.writeStartObject(); } }
@Override public void marshall(Void val, JsonMarshallerContext context, MarshallingInfo<Void> marshallingInfo) { // If paramName is non null then we are emitting a field of an object, in that // we just don't write the field. If param name is null then we are either in a container // or the thing being marshalled is the payload itself in which case we want to preserve // the JSON null. if (marshallingInfo == null || marshallingInfo.marshallLocationName() == null) { context.jsonGenerator().writeNull(); } } };
@Override public final void marshall(T val, JsonMarshallerContext context, MarshallingInfo<T> marshallingInfo) { if (!shouldEmit(val)) { return; } if (marshallingInfo != null && marshallingInfo.marshallLocationName() != null) { context.jsonGenerator().writeFieldName(marshallingInfo.marshallLocationName()); } marshall(val, context.jsonGenerator(), context, marshallingInfo); }
@Override public void marshall(Map map, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context, MarshallingInfo<Map> mapMarshallingInfo) { jsonGenerator.writeStartObject(); for (Map.Entry<String, ?> entry : ((Map<String, ?>) map).entrySet()) { if (entry.getValue() != null) { final Object value = entry.getValue(); jsonGenerator.writeFieldName(entry.getKey()); context.marshall(MarshallLocation.PAYLOAD, value); } } jsonGenerator.writeEndObject(); }
@Override public void marshall(StructuredPojo val, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context, MarshallingInfo<StructuredPojo> marshallingInfo) { jsonGenerator.writeStartObject(); val.marshall(context.protocolHandler()); jsonGenerator.writeEndObject(); } };
/** * If there is not an explicit payload member then we need to start the implicit JSON request object. All * members bound to the payload will be added as fields to this object. */ @Override public void startMarshalling() { if (!hasExplicitPayloadMember) { jsonGenerator.writeStartObject(); } }
@Override public void marshall(Void val, JsonMarshallerContext context, MarshallingInfo<Void> marshallingInfo) { // If paramName is non null then we are emitting a field of an object, in that // we just don't write the field. If param name is null then we are either in a container // or the thing being marshalled is the payload itself in which case we want to preserve // the JSON null. if (marshallingInfo == null || marshallingInfo.marshallLocationName() == null) { context.jsonGenerator().writeNull(); } } };
@Override public final void marshall(T val, JsonMarshallerContext context, MarshallingInfo<T> marshallingInfo) { if (!shouldEmit(val)) { return; } if (marshallingInfo != null && marshallingInfo.marshallLocationName() != null) { context.jsonGenerator().writeFieldName(marshallingInfo.marshallLocationName()); } marshall(val, context.jsonGenerator(), context, marshallingInfo); }
@Override public void marshall(String val, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context, MarshallingInfo<String> marshallingInfo) { jsonGenerator.writeValue(val); } };
@Override public void marshall(Map map, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context) { jsonGenerator.writeStartObject(); for (Map.Entry<String, ?> entry : ((Map<String, ?>) map).entrySet()) { if (entry.getValue() != null) { final Object value = entry.getValue(); jsonGenerator.writeFieldName(entry.getKey()); context.marshall(MarshallLocation.PAYLOAD, value); } } jsonGenerator.writeEndObject(); }
@Override public void marshall(StructuredPojo val, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context) { jsonGenerator.writeStartObject(); val.marshall(context.protocolHandler()); jsonGenerator.writeEndObject(); } };
@Override public void marshall(List list, StructuredJsonGenerator jsonGenerator, JsonMarshallerContext context, MarshallingInfo<List> marshallingInfo) { jsonGenerator.writeStartArray(); for (Object listValue : list) { context.marshall(MarshallLocation.PAYLOAD, listValue); } jsonGenerator.writeEndArray(); }
@Override public Request<OrigRequest> finishMarshalling() { // Content may already be set if the payload is binary data. if (request.getContent() == null) { // End the implicit request object if needed. if (!hasExplicitPayloadMember) { jsonGenerator.writeEndObject(); } byte[] content = jsonGenerator.getBytes(); request.setContent(new ByteArrayInputStream(content)); if (content.length > 0) { request.addHeader("Content-Length", Integer.toString(content.length)); } } if (!request.getHeaders().containsKey("Content-Type")) { request.addHeader("Content-Type", contentType); } return request; }
/** * If there is not an explicit payload member then we need to start the implicit JSON request object. All * members bound to the payload will be added as fields to this object. */ @Override public void startMarshalling() { if (!hasExplicitPayloadMember) { jsonGenerator.writeStartObject(); } }
@Override public void marshall(Void val, JsonMarshallerContext context, String paramName) { // If paramName is non null then we are emitting a field of an object, in that // we just don't write the field. If param name is null then we are either in a container // or the thing being marshalled is the payload itself in which case we want to preserve // the JSON null. if (paramName == null) { context.jsonGenerator().writeNull(); } } };