public String toString() { return field + ": " + jsonToken.asString(); } }
@Override public String getText() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { return _textValue; } if (_currToken == JsonToken.FIELD_NAME) { return _currentFieldName; } if (_currToken != null) { if (_currToken.isScalarValue()) { return _textValue; } return _currToken.asString(); } return null; }
@Override public String getText() throws IOException { if (_currToken == JsonToken.VALUE_STRING) { return _textValue; } if (_currToken == JsonToken.FIELD_NAME) { return _currentFieldName; } if (_currToken != null) { if (_currToken.isScalarValue()) { return _textValue; } return _currToken.asString(); } return null; }
protected final String _getText2(JsonToken t) { if (t == null) { return null; } switch (t.id()) { case ID_FIELD_NAME: return _parsingContext.getCurrentName(); case ID_STRING: // fall through case ID_NUMBER_INT: case ID_NUMBER_FLOAT: return _textBuffer.contentsAsString(); default: return t.asString(); } }
protected final String _getText2(JsonToken t) { if (t == null) { return null; } switch (t.id()) { case ID_FIELD_NAME: return _parsingContext.getCurrentName(); case ID_STRING: // fall through case ID_NUMBER_INT: case ID_NUMBER_FLOAT: return _textBuffer.contentsAsString(); default: return t.asString(); } }
protected final String _getText2(JsonToken t) { if (t == null) { return null; } switch (t.id()) { case ID_FIELD_NAME: return _parsingContext.getCurrentName(); case ID_STRING: // fall through case ID_NUMBER_INT: case ID_NUMBER_FLOAT: return _textBuffer.contentsAsString(); default: return t.asString(); } }
protected final String _getText2(JsonToken t) { if (t == null) { return null; } switch (t.id()) { case ID_NOT_AVAILABLE: return null; case ID_FIELD_NAME: return _parsingContext.getCurrentName(); case ID_STRING: // fall through case ID_NUMBER_INT: case ID_NUMBER_FLOAT: return _textBuffer.contentsAsString(); default: return t.asString(); } }
@Override public String getText() { if (_closed) { return null; } // need to separate handling a bit... switch (_currToken) { case FIELD_NAME: return _nodeCursor.getCurrentName(); case VALUE_STRING: return currentNode().textValue(); case VALUE_NUMBER_INT: case VALUE_NUMBER_FLOAT: return String.valueOf(currentNode().numberValue()); case VALUE_EMBEDDED_OBJECT: JsonNode n = currentNode(); if (n != null && n.isBinary()) { // this will convert it to base64 return n.asText(); } default: return (_currToken == null) ? null : _currToken.asString(); } }
protected final String _getText2(JsonToken t) { if (t == null) { return null; } switch (t.id()) { case ID_FIELD_NAME: return _parsingContext.currentName(); case ID_STRING: // fall through case ID_NUMBER_INT: case ID_NUMBER_FLOAT: return _textBuffer.contentsAsString(); default: return t.asString(); } }
@Override public String getText() { // common cases first: if (_currToken == JsonToken.VALUE_STRING || _currToken == JsonToken.FIELD_NAME) { Object ob = _currentObject(); if (ob instanceof String) { return (String) ob; } return ClassUtil.nullOrToString(ob); } if (_currToken == null) { return null; } switch (_currToken) { case VALUE_NUMBER_INT: case VALUE_NUMBER_FLOAT: return ClassUtil.nullOrToString(_currentObject()); default: return _currToken.asString(); } }
protected final String _getText2(JsonToken t) { if (t == null) { return null; } switch (t.id()) { case ID_FIELD_NAME: return _parsingContext.currentName(); case ID_STRING: // fall through case ID_NUMBER_INT: case ID_NUMBER_FLOAT: return _textBuffer.contentsAsString(); default: return t.asString(); } }
protected final String _getText2(JsonToken t) { if (t == null) { return null; } switch (t.id()) { case ID_FIELD_NAME: return _parsingContext.currentName(); case ID_STRING: // fall through case ID_NUMBER_INT: case ID_NUMBER_FLOAT: return _textBuffer.contentsAsString(); default: return t.asString(); } }
protected final String _getText2(JsonToken t) { if (t == null) { return null; } switch (t.id()) { case ID_NOT_AVAILABLE: return null; case ID_FIELD_NAME: return _parsingContext.currentName(); case ID_STRING: // fall through case ID_NUMBER_INT: case ID_NUMBER_FLOAT: return _textBuffer.contentsAsString(); default: return t.asString(); } }
@Override public String getText() throws IOException { if (state == State.FIELD_NAME) { return reader.getFieldName(); } if (IonType.isText(reader.getType())) { return reader.stringValue(); } if (currentToken == null) { // start or end of stream return null; } if (currentToken.isNumeric()) { return getNumberValue().toString(); } return currentToken.asString(); }
public String toString() { return field + ": " + jsonToken.asString(); } }
@Override public String getText() throws IOException { if (state == State.FIELD_NAME) { return reader.getFieldName(); } if (IonType.isText(reader.getType())) { return reader.stringValue(); } if (currentToken == null) { // start or end of stream return null; } if (currentToken.isNumeric()) { return getNumberValue().toString(); } return currentToken.asString(); }
@Override public Shape deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonToken t = jp.getCurrentToken(); if(t.isStructStart()) { return read( jp, ctx.getShapeFactory() ); } if (t.isScalarValue()) { String txt = t.asString(); if(txt!=null && txt.length()>0) { try { return ctx.getFormats().read(txt); } catch (Exception e) { throw new JsonParseException(jp, "error reading shape", e); } } return null; // empty string } throw new JsonParseException(jp, "can't read GeoJSON yet"); } }
private Optional<Domain> domain(TreeNode node) throws IOException, JsonParseException { TreeNode value = node.get(QUOTA_ROOT_DOMAIN_FIELD); if (value == null || value.isMissingNode()) { return Optional.empty(); } return Optional.ofNullable(node.asToken().asString()).map(Domain::of); }
@Override public String getText() throws IOException { JsonToken t = _currToken; if (t == JsonToken.VALUE_STRING) { return _readContext.getCurrentText(); } if (t == JsonToken.FIELD_NAME) { return _readContext.getCurrentName(); } // shouldn't have non-String scalar values so: return (t == null) ? null : t.asString(); }
@Override public String getText() throws IOException { JsonToken t = _currToken; if (t == JsonToken.VALUE_STRING) { return _readContext.getCurrentText(); } if (t == JsonToken.FIELD_NAME) { return _readContext.currentName(); } // shouldn't have non-String scalar values so: return (t == null) ? null : t.asString(); }