Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More API updates #13699

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* Base Codec class for Avro encoder and decoder implementations
*/
public class AvroSchemaRegistryCodec implements SchemaRegistryCodec {
private final ClientLogger logger = new ClientLogger(AvroCodec.class);
private final ClientLogger logger = new ClientLogger(AvroSchemaRegistryCodec.class);
private static final EncoderFactory ENCODER_FACTORY = EncoderFactory.get();
private static final DecoderFactory DECODER_FACTORY = DecoderFactory.get();
private static final Boolean AVRO_SPECIFIC_READER_DEFAULT = false;
Expand Down Expand Up @@ -124,6 +124,7 @@ public byte[] encode(Object object) {
* @return deserialized object
* @throws SerializationException upon deserialization failure
*/
@Override
public Object decode(byte[] b, Object object) {
Objects.requireNonNull(object, "Schema must not be null.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Asynchronous registry-based serializer implementation.
*/
public class SchemaRegistryAvroAsyncSerializer extends SchemaRegistrySerializer implements ObjectSerializer {
public final class SchemaRegistryAvroAsyncSerializer extends SchemaRegistrySerializer implements ObjectSerializer {
private final ClientLogger logger = new ClientLogger(SchemaRegistryAvroAsyncSerializer.class);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @see SchemaRegistrySerializer See AbstractSchemaRegistrySerializer for internal serialization implementation
*/
public class SchemaRegistryAvroSerializer {
public final class SchemaRegistryAvroSerializer {
private final SchemaRegistryAvroAsyncSerializer serializer;
SchemaRegistryAvroSerializer(SchemaRegistryAvroAsyncSerializer serializer) {
this.serializer = serializer;
Expand All @@ -31,7 +31,7 @@ public class SchemaRegistryAvroSerializer {
* @return byte array containing unique ID reference to schema, then the object serialized into bytes
* @throws SerializationException Throws on serialization failure.
*/
public byte[] serialize(Object object) throws SerializationException {
public byte[] serialize(Object object) {
if (object == null) {
return null;
}
Expand All @@ -53,8 +53,8 @@ public byte[] serialize(Object object) throws SerializationException {
* @throws SerializationException Throws on deserialization failure.
* Exception may contain inner exceptions detailing failure condition.
*/
public Object deserialize(byte[] data) throws SerializationException {
return serializer.deserialize(new ByteArrayInputStream(data), Object.class);
public <T> T deserialize(byte[] data, Class<T> clazz) {
return serializer.deserialize(new ByteArrayInputStream(data), clazz).block();
}
}