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.
------------------ ???????? ------------------ ??????: "";<[email protected]>; ????????: 2016??10??22??(??????) ????10:28 ??????: "dev"<[email protected]>; ????: ?????? 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";<[email protected]>; ????????: 2016??10??22??(??????) ????8:11 ??????: "dev"<[email protected]>; ????: 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. HTH On Sat, Oct 22, 2016 at 1:06 AM, Paul Merlin <[email protected]> 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 ); > } > > HTH > > -- Niclas Hedhman, Software Developer http://zest.apache.org - New Energy for Java
