private static byte[] translateBytes(Object value) { byte[] bytes = (value.getClass() == ByteString.class) ? ((ByteString) value).copyBytes() : Data.stringToBytes((String) value, true); return bytes; }
@Override public Iterable<Map.Entry<String, Object>> orderMap(DataMap map) { if (_currentSchema != null && _currentSchema.getType() == DataSchema.Type.RECORD) { return orderMapEntries((RecordDataSchema) _currentSchema, map); } return Data.orderMapEntries(map); }
protected void writeDataTemplate( Object data, DataSchema schema, JsonGenerator generator, boolean order) throws IOException { if (order) { JsonTraverseCallback callback = new SchemaOrderTraverseCallback(schema, generator); Data.traverse(data, callback); generator.flush(); generator.close(); } else { writeObject(data, generator); } }