test_class.declarator: TOPIC = "topic"
test_class.modifier: private static final
test_class.original_string: private static final String TOPIC = "topic";
test_class.type: String
test_class.var_name: TOPIC
test_class.declarator: objectMapper = new ObjectMapper()
test_class.original_string: ObjectMapper objectMapper = new ObjectMapper();
test_class.type: ObjectMapper
test_class.var_name: objectMapper
test_class.declarator: converter = new JsonConverter()
test_class.original_string: JsonConverter converter = new JsonConverter();
test_class.type: JsonConverter
test_class.var_name: converter
test_class.file: connect/json/src/test/java/org/apache/kafka/connect/json/JsonConverterTest.java
test_class.identifier: JsonConverterTest
test_case.body: @Test
      public void longToConnect() {
          assertEquals(new SchemaAndValue(Schema.INT64_SCHEMA, 12L), converter.toConnectData(TOPIC, "{ \"schema\": { \"type\": \"int64\" }, \"payload\": 12 }".getBytes()));
          assertEquals(new SchemaAndValue(Schema.INT64_SCHEMA, 4398046511104L), converter.toConnectData(TOPIC, "{ \"schema\": { \"type\": \"int64\" }, \"payload\": 4398046511104 }".getBytes()));
      }
test_case.class_method_signature: JsonConverterTest.longToConnect()
test_case.full_signature: @Test public void longToConnect()
test_case.identifier: longToConnect
test_case.invocations: assertEquals toConnectData getBytes assertEquals toConnectData getBytes
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void longToConnect()
focal_class.declarator: SCHEMAS_ENABLE_CONFIG = "schemas.enable"
focal_class.modifier: private static final
focal_class.original_string: private static final String SCHEMAS_ENABLE_CONFIG = "schemas.enable";
focal_class.type: String
focal_class.var_name: SCHEMAS_ENABLE_CONFIG
focal_class.declarator: SCHEMAS_ENABLE_DEFAULT = true
focal_class.modifier: private static final
focal_class.original_string: private static final boolean SCHEMAS_ENABLE_DEFAULT = true;
focal_class.type: boolean
focal_class.var_name: SCHEMAS_ENABLE_DEFAULT
focal_class.declarator: SCHEMAS_CACHE_SIZE_CONFIG = "schemas.cache.size"
focal_class.modifier: private static final
focal_class.original_string: private static final String SCHEMAS_CACHE_SIZE_CONFIG = "schemas.cache.size";
focal_class.type: String
focal_class.var_name: SCHEMAS_CACHE_SIZE_CONFIG
focal_class.declarator: SCHEMAS_CACHE_SIZE_DEFAULT = 1000
focal_class.modifier: private static final
focal_class.original_string: private static final int SCHEMAS_CACHE_SIZE_DEFAULT = 1000;
focal_class.type: int
focal_class.var_name: SCHEMAS_CACHE_SIZE_DEFAULT
focal_class.declarator: TO_CONNECT_CONVERTERS = new HashMap<>()
focal_class.modifier: private static final
focal_class.original_string: private static final HashMap<Schema.Type, JsonToConnectTypeConverter> TO_CONNECT_CONVERTERS = new HashMap<>();
focal_class.type: HashMap<Schema.Type, JsonToConnectTypeConverter>
focal_class.var_name: TO_CONNECT_CONVERTERS
focal_class.declarator: TO_CONNECT_LOGICAL_CONVERTERS = new HashMap<>()
focal_class.modifier: private static final
focal_class.original_string: private static final HashMap<String, LogicalTypeConverter> TO_CONNECT_LOGICAL_CONVERTERS = new HashMap<>();
focal_class.type: HashMap<String, LogicalTypeConverter>
focal_class.var_name: TO_CONNECT_LOGICAL_CONVERTERS
focal_class.declarator: TO_JSON_LOGICAL_CONVERTERS = new HashMap<>()
focal_class.modifier: private static final
focal_class.original_string: private static final HashMap<String, LogicalTypeConverter> TO_JSON_LOGICAL_CONVERTERS = new HashMap<>();
focal_class.type: HashMap<String, LogicalTypeConverter>
focal_class.var_name: TO_JSON_LOGICAL_CONVERTERS
focal_class.declarator: enableSchemas = SCHEMAS_ENABLE_DEFAULT
focal_class.modifier: private
focal_class.original_string: private boolean enableSchemas = SCHEMAS_ENABLE_DEFAULT;
focal_class.type: boolean
focal_class.var_name: enableSchemas
focal_class.declarator: cacheSize = SCHEMAS_CACHE_SIZE_DEFAULT
focal_class.modifier: private
focal_class.original_string: private int cacheSize = SCHEMAS_CACHE_SIZE_DEFAULT;
focal_class.type: int
focal_class.var_name: cacheSize
focal_class.declarator: fromConnectSchemaCache
focal_class.modifier: private
focal_class.original_string: private Cache<Schema, ObjectNode> fromConnectSchemaCache;
focal_class.type: Cache<Schema, ObjectNode>
focal_class.var_name: fromConnectSchemaCache
focal_class.declarator: toConnectSchemaCache
focal_class.modifier: private
focal_class.original_string: private Cache<JsonNode, Schema> toConnectSchemaCache;
focal_class.type: Cache<JsonNode, Schema>
focal_class.var_name: toConnectSchemaCache
focal_class.declarator: serializer = new JsonSerializer()
focal_class.modifier: private final
focal_class.original_string: private final JsonSerializer serializer = new JsonSerializer();
focal_class.type: JsonSerializer
focal_class.var_name: serializer
focal_class.declarator: deserializer = new JsonDeserializer()
focal_class.modifier: private final
focal_class.original_string: private final JsonDeserializer deserializer = new JsonDeserializer();
focal_class.type: JsonDeserializer
focal_class.var_name: deserializer
focal_class.file: connect/json/src/main/java/org/apache/kafka/connect/json/JsonConverter.java
focal_class.identifier: JsonConverter
focal_class.interfaces: implements Converter
focal_class.class_method_signature: JsonConverter.checkOptionalAndDefault(Schema schema)
focal_class.full_signature: private static Object checkOptionalAndDefault(Schema schema)
focal_class.identifier: checkOptionalAndDefault
focal_class.modifiers: private static
focal_class.parameters: (Schema schema)
focal_class.return: Object
focal_class.signature: Object checkOptionalAndDefault(Schema schema)
focal_class.class_method_signature: JsonConverter.configure(Map<String, ?> configs, boolean isKey)
focal_class.full_signature: @Override public void configure(Map<String, ?> configs, boolean isKey)
focal_class.identifier: configure
focal_class.modifiers: @Override public
focal_class.parameters: (Map<String, ?> configs, boolean isKey)
focal_class.return: void
focal_class.signature: void configure(Map<String, ?> configs, boolean isKey)
focal_class.class_method_signature: JsonConverter.fromConnectData(String topic, Schema schema, Object value)
focal_class.full_signature: @Override public byte[] fromConnectData(String topic, Schema schema, Object value)
focal_class.identifier: fromConnectData
focal_class.modifiers: @Override public
focal_class.parameters: (String topic, Schema schema, Object value)
focal_class.return: byte[]
focal_class.signature: byte[] fromConnectData(String topic, Schema schema, Object value)
focal_class.class_method_signature: JsonConverter.toConnectData(String topic, byte[] value)
focal_class.full_signature: @Override public SchemaAndValue toConnectData(String topic, byte[] value)
focal_class.identifier: toConnectData
focal_class.modifiers: @Override public
focal_class.parameters: (String topic, byte[] value)
focal_class.return: SchemaAndValue
focal_class.signature: SchemaAndValue toConnectData(String topic, byte[] value)
focal_class.class_method_signature: JsonConverter.jsonToConnect(JsonNode jsonValue)
focal_class.full_signature: private SchemaAndValue jsonToConnect(JsonNode jsonValue)
focal_class.identifier: jsonToConnect
focal_class.modifiers: private
focal_class.parameters: (JsonNode jsonValue)
focal_class.return: SchemaAndValue
focal_class.signature: SchemaAndValue jsonToConnect(JsonNode jsonValue)
focal_class.class_method_signature: JsonConverter.asJsonSchema(Schema schema)
focal_class.full_signature: private ObjectNode asJsonSchema(Schema schema)
focal_class.identifier: asJsonSchema
focal_class.modifiers: private
focal_class.parameters: (Schema schema)
focal_class.return: ObjectNode
focal_class.signature: ObjectNode asJsonSchema(Schema schema)
focal_class.class_method_signature: JsonConverter.asConnectSchema(JsonNode jsonSchema)
focal_class.full_signature: private Schema asConnectSchema(JsonNode jsonSchema)
focal_class.identifier: asConnectSchema
focal_class.modifiers: private
focal_class.parameters: (JsonNode jsonSchema)
focal_class.return: Schema
focal_class.signature: Schema asConnectSchema(JsonNode jsonSchema)
focal_class.class_method_signature: JsonConverter.convertToJsonWithEnvelope(Schema schema, Object value)
focal_class.full_signature: private JsonNode convertToJsonWithEnvelope(Schema schema, Object value)
focal_class.identifier: convertToJsonWithEnvelope
focal_class.modifiers: private
focal_class.parameters: (Schema schema, Object value)
focal_class.return: JsonNode
focal_class.signature: JsonNode convertToJsonWithEnvelope(Schema schema, Object value)
focal_class.class_method_signature: JsonConverter.convertToJsonWithoutEnvelope(Schema schema, Object value)
focal_class.full_signature: private JsonNode convertToJsonWithoutEnvelope(Schema schema, Object value)
focal_class.identifier: convertToJsonWithoutEnvelope
focal_class.modifiers: private
focal_class.parameters: (Schema schema, Object value)
focal_class.return: JsonNode
focal_class.signature: JsonNode convertToJsonWithoutEnvelope(Schema schema, Object value)
focal_class.class_method_signature: JsonConverter.convertToJson(Schema schema, Object logicalValue)
focal_class.full_signature: private static JsonNode convertToJson(Schema schema, Object logicalValue)
focal_class.identifier: convertToJson
focal_class.modifiers: private static
focal_class.parameters: (Schema schema, Object logicalValue)
focal_class.return: JsonNode
focal_class.signature: JsonNode convertToJson(Schema schema, Object logicalValue)
focal_class.class_method_signature: JsonConverter.convertToConnect(Schema schema, JsonNode jsonValue)
focal_class.full_signature: private static Object convertToConnect(Schema schema, JsonNode jsonValue)
focal_class.identifier: convertToConnect
focal_class.modifiers: private static
focal_class.parameters: (Schema schema, JsonNode jsonValue)
focal_class.return: Object
focal_class.signature: Object convertToConnect(Schema schema, JsonNode jsonValue)
focal_method.body: @Override
      public SchemaAndValue toConnectData(String topic, byte[] value) {
          JsonNode jsonValue;
          try {
              jsonValue = deserializer.deserialize(topic, value);
          } catch (SerializationException e) {
              throw new DataException("Converting byte[] to Kafka Connect data failed due to serialization error: ", e);
          }
  
          if (enableSchemas && (jsonValue == null || !jsonValue.isObject() || jsonValue.size() != 2 || !jsonValue.has("schema") || !jsonValue.has("payload")))
              throw new DataException("JsonDeserializer with schemas.enable requires \"schema\" and \"payload\" fields and may not contain additional fields");
  
          // The deserialized data should either be an envelope object containing the schema and the payload or the schema
          // was stripped during serialization and we need to fill in an all-encompassing schema.
          if (!enableSchemas) {
              ObjectNode envelope = JsonNodeFactory.instance.objectNode();
              envelope.set("schema", null);
              envelope.set("payload", jsonValue);
              jsonValue = envelope;
          }
  
          return jsonToConnect(jsonValue);
      }
focal_method.class_method_signature: JsonConverter.toConnectData(String topic, byte[] value)
focal_method.full_signature: @Override public SchemaAndValue toConnectData(String topic, byte[] value)
focal_method.identifier: toConnectData
focal_method.invocations: deserialize isObject size has has objectNode set set jsonToConnect
focal_method.modifiers: @Override public
focal_method.parameters: (String topic, byte[] value)
focal_method.return: SchemaAndValue
focal_method.signature: SchemaAndValue toConnectData(String topic, byte[] value)