public static String toJson(KdbTree kdbTree) { requireNonNull(kdbTree, "kdbTree is null"); return KDB_TREE_CODEC.toJson(kdbTree); } }
public static KdbTree fromJson(String json) { requireNonNull(json, "json is null"); return KDB_TREE_CODEC.fromJson(json); }
@Override public JsonCodec<T> get() { return codecFactory.jsonCodec(clazz); }
@Override public void configure(Binder binder) { binder.bind(TypeManager.class).toInstance(typeManager); binder.bind(ExampleConnector.class).in(Scopes.SINGLETON); binder.bind(ExampleConnectorId.class).toInstance(new ExampleConnectorId(connectorId)); binder.bind(ExampleMetadata.class).in(Scopes.SINGLETON); binder.bind(ExampleClient.class).in(Scopes.SINGLETON); binder.bind(ExampleSplitManager.class).in(Scopes.SINGLETON); binder.bind(ExampleRecordSetProvider.class).in(Scopes.SINGLETON); configBinder(binder).bindConfig(ExampleConfig.class); jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class); jsonCodecBinder(binder).bindMapJsonCodec(String.class, listJsonCodec(ExampleTable.class)); }
public CodecSupplier(Class<T> clazz, Metadata metadata) { this.clazz = clazz; ObjectMapperProvider objectMapperProvider = new ObjectMapperProvider(); objectMapperProvider.setJsonDeserializers(ImmutableMap.of(Type.class, new TypeDeserializer(metadata))); this.codecFactory = new JsonCodecFactory(objectMapperProvider); }
private static JsonCodec<ViewDefinition> createTestingViewCodec() { ObjectMapperProvider provider = new ObjectMapperProvider(); provider.setJsonDeserializers(ImmutableMap.of(Type.class, new TypeDeserializer(new TypeRegistry()))); return new JsonCodecFactory(provider).jsonCodec(ViewDefinition.class); }
@Override public ColumnHandle deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { return new ObjectMapperProvider().get().readValue(jsonParser, TestingColumnHandle.class); } })
public Slice toSlice() { return Slices.wrappedBuffer(MEMORY_DATA_FRAGMENT_CODEC.toJsonBytes(this)); }
private static List<String> fromJsonString(String jsonString) { return jsonString == null ? ImmutableList.of() : queriesJsonCodec.fromJson(jsonString); } }
public CodecSupplier(Class<T> clazz, Metadata metadata) { this.clazz = clazz; this.metadata = metadata; ObjectMapperProvider objectMapperProvider = new ObjectMapperProvider(); objectMapperProvider.setJsonDeserializers(ImmutableMap.of(Type.class, new TypeDeserializer())); this.codecFactory = new JsonCodecFactory(objectMapperProvider); }
@Override public ColumnHandle deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { return new ObjectMapperProvider().get().readValue(jsonParser, TestingColumnHandle.class); } }));
@Override public JsonCodec<T> get() { return codecFactory.jsonCodec(clazz); }
private ViewDefinition deserializeView(String data) { try { return viewCodec.fromJson(data); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_VIEW, "Invalid view JSON: " + data, e); } }
public CodecSupplier(Class<T> clazz, Metadata metadata) { this.clazz = requireNonNull(clazz, "clazz is null"); this.metadata = requireNonNull(metadata, "metadata is null"); ObjectMapperProvider objectMapperProvider = new ObjectMapperProvider(); objectMapperProvider.setJsonDeserializers(ImmutableMap.of(Type.class, new TypeDeserializer())); this.codecFactory = new JsonCodecFactory(objectMapperProvider); }
@Override public JsonCodec<T> get() { return codecFactory.jsonCodec(clazz); }
public static MemoryDataFragment fromSlice(Slice fragment) { return MEMORY_DATA_FRAGMENT_CODEC.fromJson(fragment.getBytes()); }