I have MyComputedValue extending ValueComposite with inner class mixin
providing property implemetation:
@Mixins(MyComputedValue.MyComputedMixin.class)
public interface MyComputedValue extends ValueComposite, MyComputed {
abstract class MyComputedMixin implements MyComputed {
@Override
public Property<Integer> computedValue() {
return new ComputedPropertyInstance<Integer>(
new GenericPropertyInfo(MyComputed.class,
"computedValue")) {
@Override
public Integer get() {
return 1234;
}
};
}
}
}
2011/5/18 Niclas Hedhman <[email protected]>
> Also, what is providing the implementation for the computed property??
>
> 2011/5/19 Łukasz Zieliński <[email protected]>:
> > Hi,
> > I cleaned up my test case to leave only bare minimum. I have structure
> like
> > this:
> >
> > //ENTITY
> > public interface My {
> > Property<MyComputed> singleComputed();
> > }
> >
> > //VALUE
> > public interface MyComputed {
> > @Computed
> > Property<Integer> computedValue();
> > }
> >
> > When trying to create the entity:
> >
> > MyComputed myComputed = valueFactory.newValue(MyComputed.class);
> > EntityBuilder<My> entityBuilder = uow.newEntityBuilder(My.class);
> > entityBuilder.instance().singleComputed().set(myComputed);
> > entityBuilder.newInstance();
> >
> > Exception is thrown:
> >
> > java.lang.IllegalStateException: Property [computedValue] must be
> computed
> >
> > In the end I changed property to getter - as it was an overkill, however
> it
> > seems that computed properties on values don't mix well with entities. :)
> >
> > Regards,
> > Łukasz
> >
> > I added test case as issue attachment.
> >>
> >> Regards,
> >> Łukasz
> >>
> >>
> >> 2011/5/16 Niclas Hedhman <[email protected]>
> >>
> >>> I have added you to Community Team.
> >>>
> >>> For the below, can you provide a test case, because by the sound of
> >>> it, it is either a incorrect error message or you are using @Computed
> >>> incorrectly...
> >>>
> >>> Cheers
> >>> Niclas
> >>>
> >>> On Mon, May 16, 2011 at 5:36 AM, Lukasz Zielinski (JIRA)
> >>> <[email protected]> wrote:
> >>> > ValueComposite with @Computed Property causes IllegalStateException
> when
> >>> part of EntityComposite
> >>> >
> >>>
> ------------------------------------------------------------------------------------------------
> >>> >
> >>> > Key: QI-346
> >>> > URL: http://issues.ops4j.org/browse/QI-346
> >>> > Project: Qi4j
> >>> > Issue Type: Bug
> >>> > Components: Persistence
> >>> > Affects Versions: 1.3
> >>> > Reporter: Lukasz Zielinski
> >>> > Fix For: 1.4
> >>> > Attachments: CompOnValueTest.java
> >>> >
> >>> > ValueComposite with @Computed Property cannot be used as part of
> >>> EntityComposite.
> >>> >
> >>> > java.lang.IllegalStateException: Property [computedValue] must be
> >>> computed
> >>> > at
> >>>
> org.qi4j.runtime.property.AbstractPropertyModel$ComputedPropertyInfo.get(AbstractPropertyModel.java:294)
> >>> > at
> >>>
> org.qi4j.runtime.property.PropertiesInstance.visitProperties(PropertiesInstance.java:58)
> >>> > at
> >>>
> org.qi4j.runtime.types.ValueCompositeType.toJSON(ValueCompositeType.java:131)
> >>> > at
> >>>
> org.qi4j.runtime.types.SerializableType.toJSON(SerializableType.java:74)
> >>> > at
> >>>
> org.qi4j.spi.entitystore.helpers.JSONEntityState.setProperty(JSONEntityState.java:152)
> >>> > at
> >>>
> org.qi4j.runtime.entity.EntityPropertyInstance.set(EntityPropertyInstance.java:90)
> >>> >
> >>> > --
> >>> > This message is automatically generated by JIRA.
> >>> > -
> >>> > If you think it was sent incorrectly contact one of the
> administrators:
> >>> http://issues.ops4j.org/secure/Administrators.jspa
> >>> > -
> >>> > For more information on JIRA, see:
> >>> http://www.atlassian.com/software/jira
> >>> >
> >>> >
> >>> >
> >>> > _______________________________________________
> >>> > qi4j-dev mailing list
> >>> > [email protected]
> >>> > http://lists.ops4j.org/mailman/listinfo/qi4j-dev
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Niclas Hedhman, Software Developer
> >>> http://www.qi4j.org - New Energy for Java
> >>>
> >>> I live here; http://tinyurl.com/3xugrbk
> >>> I work here; http://tinyurl.com/24svnvk
> >>> I relax here; http://tinyurl.com/2cgsug
> >>>
> >>> _______________________________________________
> >>> qi4j-dev mailing list
> >>> [email protected]
> >>> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
> >>>
> >>
> >>
> >>
> >> --
> >> Pozdrawiam,
> >> Łukasz Zieliński
> >>
> >
> >
> >
> > --
> > Pozdrawiam,
> > Łukasz Zieliński
> > _______________________________________________
> > qi4j-dev mailing list
> > [email protected]
> > http://lists.ops4j.org/mailman/listinfo/qi4j-dev
> >
>
>
>
> --
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
>
> I live here; http://tinyurl.com/3xugrbk
> I work here; http://tinyurl.com/24svnvk
> I relax here; http://tinyurl.com/2cgsug
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>
--
Pozdrawiam,
Łukasz Zieliński
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev