Implicit Collection where collection is a generic type

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Implicit Collection where collection is a generic type

Gabriel Rossetti

Hi all,

I have an issue un-serializing a class with a generic type. Here is an example:

public abstract class Message<T> {

  protected T data;
  // getters and setters
}

public class StringListMessage extends Message <List<String> > {

  protected T data;
  // getters and setters
}

For example. I am using addImplicitCollection like this:

xstream.addImplicitCollection(StringListMessage.class, "data");

get the following error:

Field "data" declares no collection or array

I can't find anything online about this.

Thanks,
Gabriel

Reply | Threaded
Open this post in threaded view
|

Re: Implicit Collection where collection is a generic type

Jörg Schaible-2
Hi Gabriel,

Gabriel Rossetti wrote:

> Hi all,
>
> I have an issue un-serializing a class with a generic type. Here is an
> example:
>
> public abstract class Message<T> {
>
>   protected T data;
>   // getters and setters
> }
>
> public class StringListMessage extends Message <List<String> > {
>
>   protected T data;
>   // getters and setters
> }
>
> For example. I am using addImplicitCollection like this:
>
> xstream.addImplicitCollection(StringListMessage.class, "data");
>
> get the following error:
>
> Field "data" declares no collection or array
>
> I can't find anything online about this.

the case is simply not supported. However, IIRC it is possible to get the
bounded type at runtime (currently it simply detects "Object"). Please open
a JIRA issue.

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Implicit Collection where collection is a generic type

Gabriel Rossetti
Hi Jörg,

ok, I tried but I need to request access to the JIRA, is that you that has to give me access?

Thanks,
Gabriel


On Mon, Jun 30, 2014 at 6:57 PM, Jörg Schaible <[hidden email]> wrote:
Hi Gabriel,

Gabriel Rossetti wrote:

> Hi all,
>
> I have an issue un-serializing a class with a generic type. Here is an
> example:
>
> public abstract class Message<T> {
>
>   protected T data;
>   // getters and setters
> }
>
> public class StringListMessage extends Message <List<String> > {
>
>   protected T data;
>   // getters and setters
> }
>
> For example. I am using addImplicitCollection like this:
>
> xstream.addImplicitCollection(StringListMessage.class, "data");
>
> get the following error:
>
> Field "data" declares no collection or array
>
> I can't find anything online about this.

the case is simply not supported. However, IIRC it is possible to get the
bounded type at runtime (currently it simply detects "Object"). Please open
a JIRA issue.

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Re: Implicit Collection where collection is a generic type

Jörg Schaible-4
Hi Gabriel,

Gabriel Rossetti wrote:

> Hi Jörg,
>
> ok, I tried but I need to request access to the JIRA, is that you that has
> to give me access?

You have to create a full account at xircles.codehaus.org that will be used
also as JIRA account. XStream is just using Codehaus resources, we have no
further administrative rights.

Cheers,
Jörg

>
> Thanks,
> Gabriel
>
>
> On Mon, Jun 30, 2014 at 6:57 PM, Jörg Schaible
> <[hidden email]> wrote:
>
>> Hi Gabriel,
>>
>> Gabriel Rossetti wrote:
>>
>> > Hi all,
>> >
>> > I have an issue un-serializing a class with a generic type. Here is an
>> > example:
>> >
>> > public abstract class Message<T> {
>> >
>> >   protected T data;
>> >   // getters and setters
>> > }
>> >
>> > public class StringListMessage extends Message <List<String> > {
>> >
>> >   protected T data;
>> >   // getters and setters
>> > }
>> >
>> > For example. I am using addImplicitCollection like this:
>> >
>> > xstream.addImplicitCollection(StringListMessage.class, "data");
>> >
>> > get the following error:
>> >
>> > Field "data" declares no collection or array
>> >
>> > I can't find anything online about this.
>>
>> the case is simply not supported. However, IIRC it is possible to get the
>> bounded type at runtime (currently it simply detects "Object"). Please
>> open a JIRA issue.
>>
>> Cheers,
>> Jörg
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email