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 testJsonSchemaMetadataTranslation() {
          JsonNode converted = parse(converter.fromConnectData(TOPIC, Schema.BOOLEAN_SCHEMA, true));
          validateEnvelope(converted);
          assertEquals(parse("{ \"type\": \"boolean\", \"optional\": false }"), converted.get(JsonSchema.ENVELOPE_SCHEMA_FIELD_NAME));
          assertEquals(true, converted.get(JsonSchema.ENVELOPE_PAYLOAD_FIELD_NAME).booleanValue());
  
          converted = parse(converter.fromConnectData(TOPIC, Schema.OPTIONAL_BOOLEAN_SCHEMA, null));
          validateEnvelope(converted);
          assertEquals(parse("{ \"type\": \"boolean\", \"optional\": true }"), converted.get(JsonSchema.ENVELOPE_SCHEMA_FIELD_NAME));
          assertTrue(converted.get(JsonSchema.ENVELOPE_PAYLOAD_FIELD_NAME).isNull());
  
          converted = parse(converter.fromConnectData(TOPIC, SchemaBuilder.bool().defaultValue(true).build(), true));
          validateEnvelope(converted);
          assertEquals(parse("{ \"type\": \"boolean\", \"optional\": false, \"default\": true }"), converted.get(JsonSchema.ENVELOPE_SCHEMA_FIELD_NAME));
          assertEquals(true, converted.get(JsonSchema.ENVELOPE_PAYLOAD_FIELD_NAME).booleanValue());
  
          converted = parse(converter.fromConnectData(TOPIC, SchemaBuilder.bool().required().name("bool").version(3).doc("the documentation").parameter("foo", "bar").build(), true));
          validateEnvelope(converted);
          assertEquals(parse("{ \"type\": \"boolean\", \"optional\": false, \"name\": \"bool\", \"version\": 3, \"doc\": \"the documentation\", \"parameters\": { \"foo\": \"bar\" }}"),
                  converted.get(JsonSchema.ENVELOPE_SCHEMA_FIELD_NAME));
          assertEquals(true, converted.get(JsonSchema.ENVELOPE_PAYLOAD_FIELD_NAME).booleanValue());
      }
test_case.class_method_signature: JsonConverterTest.testJsonSchemaMetadataTranslation()
test_case.full_signature: @Test public void testJsonSchemaMetadataTranslation()
test_case.identifier: testJsonSchemaMetadataTranslation
test_case.invocations: parse fromConnectData validateEnvelope assertEquals parse get assertEquals booleanValue get parse fromConnectData validateEnvelope assertEquals parse get assertTrue isNull get parse fromConnectData build defaultValue bool validateEnvelope assertEquals parse get assertEquals booleanValue get parse fromConnectData build parameter doc version name required bool validateEnvelope assertEquals parse get assertEquals booleanValue get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testJsonSchemaMetadataTranslation()
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 byte[] fromConnectData(String topic, Schema schema, Object value) {
          JsonNode jsonValue = enableSchemas ? convertToJsonWithEnvelope(schema, value) : convertToJsonWithoutEnvelope(schema, value);
          try {
              return serializer.serialize(topic, jsonValue);
          } catch (SerializationException e) {
              throw new DataException("Converting Kafka Connect data to byte[] failed due to serialization error: ", e);
          }
      }
focal_method.class_method_signature: JsonConverter.fromConnectData(String topic, Schema schema, Object value)
focal_method.full_signature: @Override public byte[] fromConnectData(String topic, Schema schema, Object value)
focal_method.identifier: fromConnectData
focal_method.invocations: convertToJsonWithEnvelope convertToJsonWithoutEnvelope serialize
focal_method.modifiers: @Override public
focal_method.parameters: (String topic, Schema schema, Object value)
focal_method.return: byte[]
focal_method.signature: byte[] fromConnectData(String topic, Schema schema, Object value)