/** * Factory method for getting an instance of JSON null node (which * represents literal null value) */ public NullNode nullNode() { return NullNode.getInstance(); }
Schema defaultType = fieldSchema.getTypes().get(0); if (defaultType.getType() == Schema.Type.NULL) { defaultValue = NullNode.getInstance();
/** * Factory method for getting an instance of JSON null node (which * represents literal null value) */ public NullNode nullNode() { return NullNode.getInstance(); }
case NULL: in.readNull(); return NullNode.getInstance(); case ARRAY: ArrayNode array = JsonNodeFactory.instance.arrayNode();
public static Schema.Field generateAvroField(SchemaField field) { return new Schema.Field(field.getName(), generateAvroSchema(field.getType()), null, NullNode.getInstance()); }
/** * Factory method for getting an instance of JSON null node (which * represents literal null value) */ public NullNode nullNode() { return NullNode.getInstance(); }
/** * Factory method for getting an instance of JSON null node (which * represents literal null value) */ public NullNode nullNode() { return NullNode.getInstance(); }
private Object argValueFor(final int i) { // force a null into the map return NullNode.getInstance(); }
/** * Factory method for getting an instance of Json null node (which * represents literal null value) */ public NullNode nullNode() { return NullNode.getInstance(); }
@Override public JsonNode write(IEntity currEntity, Object value, MetaField metaField) { String resultString; if (value == null) { return NullNode.getInstance(); } else { resultString = value.toString(); } return JsonNodeFactory.instance.textNode(resultString); }
private static JsonNode toJsonNode(final List<JsonNode> matching) { switch (matching.size()) { case 0: return NullNode.getInstance(); case 1: return matching.get(0); default: final ArrayNode arrayNode = new ArrayNode(JsonNodeFactory.instance); arrayNode.addAll(matching); return arrayNode; } }
private static JsonNode toJsonNode(final List<JsonNode> matching) { switch (matching.size()) { case 0: return NullNode.getInstance(); case 1: return matching.get(0); default: final ArrayNode arrayNode = new ArrayNode(JsonNodeFactory.instance); arrayNode.addAll(matching); return arrayNode; } }
@Override public JsonNode write(IEntity currEntity, Object value, MetaField metaField) { if (value == null) { return NullNode.getInstance(); } validate(currEntity, value, metaField); long time = ((Date)value).getTime(); return JsonNodeFactory.instance.numberNode(time); }
@Override public JsonNode write(IEntity currEntity, Object value, MetaField metaField) { CheckConditions.checkNotNull(metaField); if (value == null) { return NullNode.getInstance(); } validate(currEntity, value, metaField); return JsonNodeFactory.instance.numberNode(((Number) value).intValue()); }
private Object valueRep() { final ObjectAdapter valueAdapter = objectMember.get(objectAdapter); if (valueAdapter == null) { return NullNode.getInstance(); } return DomainObjectReprRenderer.valueOrRef(resourceContext, valueAdapter, objectMember.getSpecification()); }
@Override public JsonNode write(IEntity currEntity, Object value, MetaField metaField) { CheckConditions.checkNotNull(metaField); if (value == null) { return NullNode.getInstance(); } validate(currEntity, value, metaField); return JsonNodeFactory.instance.textNode((String)value); } }
public JsonRepresentation mapPut(final String key, final BigInteger value) { if (!isMap()) { throw new IllegalStateException("does not represent map"); } final Path path = Path.parse(key); final ObjectNode node = JsonNodeUtils.walkNodeUpTo(asObjectNode(), path.getHead()); if (value != null) { node.put(path.getTail(), value.toString()); } else { node.put(path.getTail(), NullNode.getInstance()); } return this; }
private Object argValueFor(final int i) { if (objectMember.isContributed()) { final ObjectActionParameter actionParameter = objectMember.getParameters().get(i); if (actionParameter.getSpecification().isOfType(objectAdapter.getSpecification())) { return DomainObjectReprRenderer.newLinkToBuilder(resourceContext, Rel.OBJECT, objectAdapter).build(); } } // force a null into the map return NullNode.getInstance(); }
public JsonRepresentation mapPut(final String key, final Object value) { if (!isMap()) { throw new IllegalStateException("does not represent map"); } final Path path = Path.parse(key); final ObjectNode node = JsonNodeUtils.walkNodeUpTo(asObjectNode(), path.getHead()); node.put(path.getTail(), value != null ? new POJONode(value) : NullNode.getInstance()); return this; }
private void addResult(final JsonRepresentation representation) { final JsonRepresentation result = JsonRepresentation.newMap(); final ResultType resultType = addResultTo(result); if (!resultType.isVoid()) { putResultType(representation, resultType); if(returnedAdapter != null) { representation.mapPut("result", result); } else { representation.mapPut("result", NullNode.getInstance()); } } }