/** * @since 2.1 */ public String getRootValueSeparator() { return (_rootValueSeparator == null) ? null : _rootValueSeparator.getValue(); }
private final String _rootValueSeparatorAsString() { return (rootValueSeparator == null) ? null : rootValueSeparator.getValue(); }
/** * Method that fetches next token (as if calling {@link #nextToken}) and * verifies whether it is {@link JsonToken#FIELD_NAME} with specified name * and returns result of that comparison. * It is functionally equivalent to: *<pre> * return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName()); *</pre> * but may be faster for parser to verify, and can therefore be used if caller * expects to get such a property name from input next. * * @param str Property name to compare next token to (if next token is * <code>JsonToken.FIELD_NAME</code>) */ public boolean nextFieldName(SerializableString str) throws IOException { return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(getCurrentName()); }
/** * Method similar to {@link #writeRawValue(String)}, but potentially more * efficient as it may be able to use pre-encoded content (similar to * {@link #writeRaw(SerializableString)}. * * @since 2.5 */ public void writeRawValue(SerializableString raw) throws IOException { writeRawValue(raw.getValue()); }
@Override public void writeRaw(SerializableString text) throws IOException { writeRaw(text.getValue()); }
@Override public void writeString(SerializableString text) throws IOException { writeString(text.getValue()); }
@Override public void writeFieldName(SerializableString name) throws IOException { writeFieldName(name.getValue()); }
@Override public final void writeFieldName(SerializableString name) throws IOException { // Object is a value, need to verify it's allowed if (_writeContext.writeFieldName(name.getValue()) == JsonWriteContext.STATUS_EXPECT_VALUE) { _reportError("Can not write a field name, expecting a value"); } _writeFieldName(name.getValue()); }
/** * Method that will force generator to copy * input text verbatim with <b>no</b> modifications (including * that no escaping is done and no separators are added even * if context [array, object] would otherwise require such). * If such separators are desired, use * {@link #writeRawValue(String)} instead. *<p> * Note that not all generator implementations necessarily support * such by-pass methods: those that do not will throw * {@link UnsupportedOperationException}. *<p> * The default implementation delegates to {@link #writeRaw(String)}; * other backends that support raw inclusion of text are encouraged * to implement it in more efficient manner (especially if they * use UTF-8 encoding). * * @since 2.1 */ public void writeRaw(SerializableString raw) throws IOException { writeRaw(raw.getValue()); }
/** * Method similar to {@link #writeRawValue(String)}, but potentially more * efficient as it may be able to use pre-encoded content (similar to * {@link #writeRaw(SerializableString)}. */ public void writeRawValue(SerializableString raw) throws IOException { writeRawValue(raw.getValue()); }
@Override public void writeFieldName(SerializableString name) throws IOException { TokenFilter state = _filterContext.setFieldName(name.getValue()); if (state == null) { _itemFilter = null; return; } if (state == TokenFilter.INCLUDE_ALL) { _itemFilter = state; delegate.writeFieldName(name); return; } state = state.includeProperty(name.getValue()); _itemFilter = state; if (state == TokenFilter.INCLUDE_ALL) { _checkPropertyParentPath(); } }
@Override public void writeFieldName(SerializableString name) throws IOException { _writeContext.writeFieldName(name.getValue()); _append(JsonToken.FIELD_NAME, name); }
@Override public boolean nextFieldName(SerializableString str) throws IOException { // NOTE: call `nextToken()` to handle delegation return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName()); }
@Override public boolean nextFieldName(SerializableString str) throws IOException { return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName()); }
@Override public boolean nextFieldName(SerializableString str) throws IOException { return (nextToken() == JsonToken.FIELD_NAME) && str.getValue().equals(currentName()); }
@Override public void writeFieldName(SerializableString name) throws IOException { // Object is a value, need to verify it's allowed int status = _writeContext.writeFieldName(name.getValue()); if (status == JsonWriteContext.STATUS_EXPECT_VALUE) { _reportError("Can not write a field name, expecting a value"); } _writeFieldName(name, (status == JsonWriteContext.STATUS_OK_AFTER_COMMA)); }
@Override public void writeRaw(SerializableString text) throws IOException { int len = text.appendUnquoted(_outputBuffer, _outputTail); if (len < 0) { writeRaw(text.getValue()); return; } _outputTail += len; }
@Override public void writeString(SerializableString value) throws IOException { if (_itemFilter == null) { return; } if (_itemFilter != TokenFilter.INCLUDE_ALL) { TokenFilter state = _filterContext.checkValue(_itemFilter); if (state == null) { return; } if (state != TokenFilter.INCLUDE_ALL) { if (!state.includeString(value.getValue())) { return; } } _checkParentPath(); } delegate.writeString(value); }
@Override public void writeFieldName(SerializableString name) throws IOException { // Object is a value, need to verify it's allowed int status = _outputContext.writeFieldName(name.getValue()); if (status == JsonWriteContext.STATUS_EXPECT_VALUE) { _reportError("Can not write a field name, expecting a value"); } _writeFieldName(name, (status == JsonWriteContext.STATUS_OK_AFTER_COMMA)); }
@Override public JsonNode getSchema(SerializerProvider provider, Type typeHint) { if (_serializeAsIndex(provider)) { return createSchemaNode("integer", true); } ObjectNode objectNode = createSchemaNode("string", true); if (typeHint != null) { JavaType type = provider.constructType(typeHint); if (type.isEnumType()) { ArrayNode enumNode = objectNode.putArray("enum"); for (SerializableString value : _values.values()) { enumNode.add(value.getValue()); } } } return objectNode; }