By kind-label string I assume you mean a unique name uri.
Repo objects implement various interfaces:
They are Aggregates (Composite, Listing, Mapping).
Listing is an extension of java.util.List
Mapping is an extension of java.util.Map
Composite is like a Mapping but specifically models a tuple similar to a RDBMS row tuple; i.e. the elements in the tuple are keyed to a string name and not an integer index). The generated bean interfaces are Composites with getters and setters decorating the Composite.
They are Resources. Note that the generated bean interfaces don't explicitly extend from Resource.
The repository objects can be worked with like they are Pojos - using the generated interfaces. They can also be worked with as generic Resources.
To answer the question, here are possible ways:
When defining a Transaction, you can declare "T" to be of a specific Resource type, e.g.:
Transaction<Resource<?>>
Transaction<resource\<object>>
Transaction<resource\<person>>
Transaction<resource\<aggregate\<object,object>>>
Then you can perform things like:
Transaction<resource\<person>> tx = myPackage.connect("anonymous");
Resource<person> res = myTx.create("Person");
Person person = res.value();
String version = res.version().toString();
String uri = res.id().getUniqueName();</person></resource\<person></resource\<aggregate\<object,object></resource\<person></resource\<object>
Simply cast the bean to Resource:
Transaction<person> tx = myPackage.connect("anonymous");
Person person = myTx.create("Person");
String uri = ((Resource<?>)person).getUniqueName();</person>
I believe you can generate your bean interfaces extending an Interface. So have "Person" extend "Named" or "Resource<person>" (depending on how much "information hiding" you want). If the generation doesn't do it/work/or more infomation is needed, let me know.</person>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By kind-label string I assume you mean a unique name uri.
Repo objects implement various interfaces:
Listing is an extension of java.util.List
Mapping is an extension of java.util.Map
Composite is like a Mapping but specifically models a tuple similar to a RDBMS row tuple; i.e. the elements in the tuple are keyed to a string name and not an integer index). The generated bean interfaces are Composites with getters and setters decorating the Composite.
The repository objects can be worked with like they are Pojos - using the generated interfaces. They can also be worked with as generic Resources.
To answer the question, here are possible ways:
When defining a Transaction, you can declare "T" to be of a specific Resource type, e.g.:
Transaction<Resource<?>>
Transaction<resource\<object>>
Transaction<resource\<person>>
Transaction<resource\<aggregate\<object,object>>>
Then you can perform things like:
Transaction<resource\<person>> tx = myPackage.connect("anonymous");
Resource<person> res = myTx.create("Person");
Person person = res.value();
String version = res.version().toString();
String uri = res.id().getUniqueName();</person></resource\<person></resource\<aggregate\<object,object></resource\<person></resource\<object>
Simply cast the bean to Resource:
Transaction<person> tx = myPackage.connect("anonymous");
Person person = myTx.create("Person");
String uri = ((Resource<?>)person).getUniqueName();</person>
I believe you can generate your bean interfaces extending an Interface. So have "Person" extend "Named" or "Resource<person>" (depending on how much "information hiding" you want). If the generation doesn't do it/work/or more infomation is needed, let me know.</person>
Diff: