polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "zhuangmz08" <zhuangm...@qq.com>
Subject 回复: Listing composite properties
Date Sat, 22 Oct 2016 02:48:17 GMT
I've got my property descriptions, then how could I get the value of the composite? Do I need
to invoke the method using reflection? I guess there's some api in Zest. Thanks.

------------------ 原始邮件 ------------------
发件人: "";<zhuangmz08@qq.com>;
发送时间: 2016年10月22日(星期六) 上午10:28
收件人: "dev"<dev@zest.apache.org>; 

主题: 回复: Listing composite properties

Thanks all.
I'm using "org.qi4j.core:org.qi4j.core.api:2.1". Then, I need to replace org.apache.zest.api.ZestAPI
with org.qi4j.api.Qi4j, replace org.apache.zest.spi.ZestSPI with org.qi4j.spi.Qi4jSPI. I've
get my PropertyDescriptors.
SPI extends from API. And SPI is designed for building extensions. Thus, I'd better use SPI
rather than API.
Is my understanding right?

------------------ 原始邮件 ------------------
发件人: "Niclas Hedhman";<niclas@hedhman.org>;
发送时间: 2016年10月22日(星期六) 上午8:11
收件人: "dev"<dev@zest.apache.org>; 

主题: Re: Listing composite properties

Note that the EntityDescriptor (and its siblings) extends
StatefulCompositeDescriptor, which allows you to obtain the StateDescriptor/
AssociationStateDescriptor where you can get the PropertyDescriptors and
AssociationDescriptors, which is what you were asking for. If you have the
Property, you can get the PropertyDescriptor directly from the ZestAPI,
without trying to locate it inside the CompositeDescriptors.

There are a whole set of good methods in the ZestAPI class for regular
code. There are additional methods available in ZestSPI, more suitable for
use when you are creating Extensions and very generic libraries.


On Sat, Oct 22, 2016 at 1:06 AM, Paul Merlin <paul@nosphere.org> wrote:

> Hi,
> zhuangmz08 a écrit :
> > Hi, I'm trying to persist my Value/Entity Composite into database. Can I
> list all the properties (name, type) of the composite? Thanks.
> Yes! You need to get hold of your Value/Entity descriptors.
> This can be done through the ZestAPI, e.g.:
> @Structure ZestAPI api;
> void someMethod()
> {
>     EntityDescriptor descriptor = api.entityDescriptorFor( someEntity );
> }

Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message