polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Re: generic property? value composite as map keys?
Date Thu, 14 Apr 2016 23:27:02 GMT
I think it should be viewed as a bug. Could you open a Jira ticket, and
attach a small testcase? That would help a lot.

Is this using 2.1 or 'develop' branch?

If it is for 'develop', then there is a lot of internal changes going on
regarding the serialization (testcase still helps) and it will be sorted
out. If it is 2.1, I think it is serious enough to warrant a new release.

Thanks a lot for reporting/finding this.
Niclas



On Fri, Apr 15, 2016 at 12:55 AM, zhuangmz08 <zhuangmz08@qq.com> wrote:

> 1. Maybe I should remove generic Property types.
> 2. I mean, when I serialize TestEntity into EntityStore, it seems to be
> ok. But when I deserialize it from EntityStore, map2 return expected values
> but map1 throw [org.qi4j.spi.entitystore.EntityStoreException:
> org.qi4j.api.value.ValueSerializationException: Could not serialize value].
>
>
>
>
> ------------------ 原始邮件 ------------------
> 发件人: "Niclas Hedhman";<niclas@hedhman.org>;
> 发送时间: 2016年4月15日(星期五) 凌晨0:49
> 收件人: "dev"<dev@zest.apache.org>;
>
> 主题: Re: generic property? value composite as map keys?
>
>
>
> 1. No, you can't use generics in Property types. The reason is quite deep,
> related to the way we build the internal model of the Mixins and their
> State, which (at least at the moment) doesn't allow WildCardTyped classes.
> I am not totally sure if it is possible to fix this, but there is no plans
> to look into it.
>
> 2. Yes, that should be no problem. ValueComposites obeys equals() and
> hashCode() from its immutable state, i.e. Property and Association values.
> When you say "fail", what do you mean?
>
>
>
> On Fri, Apr 15, 2016 at 12:32 AM, zhuangmz08 <zhuangmz08@qq.com> wrote:
>
> > Hi, I would like to ask two questions, any help will be appreciated.
> >
> >
> > 1. Can I use generic type in Property?
> > DateTimeInterval1 fails while DateTimeInterval2 is ok in the following
> > snippet.
> > ===========SNIPPET 1===========
> > public interface ITimeInterval<T> {
> >         Property<T> start();
> >         Property<T> end();
> > }
> > public interface DateTimeInterval1 extends ITimeInterval<LocalDate>,
> > ValueComposite { // fail
> > }
> >
> >
> > public interface DateTimeInterval2 extends ValueComposite { // ok
> >         Property<LocalDate> start();
> >         Property<LocalDate> end();
> > }
> > ===========SNIPPET 1===========
> >
> >
> > 2. Can I use ValueComposite as map keys?
> > map1 fails while map2 is ok in the following snippet.
> > ===========SNIPPET 2===========
> > public interface TestEntity extends EntityComposite {
> >         Property<Map<DateTimeInterval2, String>> map1();        // fail
> >         Property<Map<String, DateTimeInterval2>> map2();        // ok
> > }
> > ===========SNIPPET 2===========
>
>
>
>
> --
> Niclas Hedhman, Software Developer
> http://zest.apache.org - New Energy for Java
>



-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message