2009/2/18 Rickard Öberg <[email protected]>

> Peter Neubauer wrote:
> > Hi Rickard,
> > I for one would need an example, but I guess just pointing to one of
> > the test cases would be enough.
>
> Alright, take a look at AbstractEntityStoreTest. In it you will see an
> Entity like this:
>     public interface TestEntity
>         extends EntityComposite
>     {
>         ...
>         @Optional Property<TestValue> valueProperty();
>         ...
>     }
> ---
> The valueProperty points to a ValueComposite. That Value looks like this:
>     public interface TestValue
>         extends ValueComposite
>     {
>         @UseDefaults
>         Property<String> stringProperty();
>
>         @UseDefaults
>         Property<Integer> intProperty();
>
>         @UseDefaults
>         Property<TestEnum> enumProperty();
>
>         @UseDefaults
>         Property<List<String>> listProperty();
>
>         Property<TestValue2> valueProperty();
>
>         Property<Map<String,String>> serializableProperty();
>     }
> ---
> So, to begin with you have a single property in the Entity which,
> through Values, can have a complex type. But it is even in many levels
> since valueProperty() above points to *another* value! It looks like this:
>     public interface TestValue2
>         extends ValueComposite
>     {
>         Property<String> stringValue();
>     }
> ---
> And it could have referenced even more value types as properties if you
> wanted to. With this you can then create quite complex models and have
> them stored. If you do this with an ORM it'd take quite some fiddling
> since it has to connect a number of tables just to get this working.
> With any serialized EntityStore it's just one load/store!
>
> Does that make it clearer?
>

good example, btw does the framework handle/detect cycles such as:

    public interface TestValue
        extends ValueComposite
    {
        Property<TestValue2> valueProperty();
    }

    public interface TestValue2
        extends ValueComposite
    {
        Property<TestValue> valueProperty();
    }

which I assume should throw some sort of configuration exception?


> /Rickard
>
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>



-- 
Cheers, Stuart
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to