[
https://issues.apache.org/jira/browse/AVRO-2357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ivan Greene updated AVRO-2357:
--
Description:
For a Java interface extending another interface with type parameters, we may
resolve actual type parameters and build the protocol definition based upon
those.
For example, let's say we have a generic protocol defined by a Java interface:
{code:java}
public interface CrudProto {
void persist(T record);
T fetchById(I id);
}{code}
It would be natural to define a set of interfaces that extend this, such as:
{code:java}
public interface FooBarRecordProto extends CrudProto {}
public interface OtherRecordProto extends CrudProto {}
{code}
Calling ReflectData.get().getProtocol(FooBarRecordProto.class) should be able
to resolve that this protocol deals in FooBarRecords and Strings, and build a
protocol accordingly.
Currently, this call will produce an exception stating that a schema for 'T'
cannot be resolved.
was:
For a Java interface extending another interface with type parameters, we may
resolve actual type parameters and build the protocol definition based upon
those.
For example, let's say we have a generic protocol defined by a Java interface:
{code:java}
public interface CrudProto {
void persist(T record);
T fetchById(I id);
}{code}
It would be natural to define a set of interfaces that extend this, such as:
{code:java}
public interface FooBarRecordProto extends CrudProto {}
public interface OtherRecordProto extends CrudProto {}
{code}
Calling ReflectData.get().getProtocol(FooBarRecordProto.class) should be able
to resolve that this protocol deals in FooBarRecords and Strings, and build a
protocol accordingly.
> (ReflectData) Support for generic types in protocol definitions
> ---
>
> Key: AVRO-2357
> URL: https://issues.apache.org/jira/browse/AVRO-2357
> Project: Apache Avro
> Issue Type: Improvement
> Components: java
>Reporter: Ivan Greene
>Priority: Minor
>
> For a Java interface extending another interface with type parameters, we may
> resolve actual type parameters and build the protocol definition based upon
> those.
> For example, let's say we have a generic protocol defined by a Java interface:
> {code:java}
> public interface CrudProto {
> void persist(T record);
> T fetchById(I id);
> }{code}
> It would be natural to define a set of interfaces that extend this, such as:
> {code:java}
> public interface FooBarRecordProto extends CrudProto {}
> public interface OtherRecordProto extends CrudProto {}
> {code}
> Calling ReflectData.get().getProtocol(FooBarRecordProto.class) should be able
> to resolve that this protocol deals in FooBarRecords and Strings, and build a
> protocol accordingly.
> Currently, this call will produce an exception stating that a schema for 'T'
> cannot be resolved.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)