@Target(value=METHOD) @Retention(value=RUNTIME) public @interface ChildrenOf
There may be multiple matching childrenOf methods for a given parent object, in which case all of the results are merged into a single set
The method must:
Example:
@ChildrenOf
public List <Band > getBands(BandsController root) {
return Band.findAll(SessionManager.session());
}
Performance Tip
Note that Milton will scan children collections to locate single objects
as part of resource location if no @ChildOf method is present. It will
also scan by default if any @ChildOf methods have returned null. This
can be a performance problem in many cases. To prevent @ChildrenOf methods
being used to locate single items set the allowChildLookups property to false| Modifier and Type | Optional Element and Description |
|---|---|
boolean |
allowChildLookups
If true (default) then the method this annotates can be used to locate single
items.
|
boolean |
override
If true this method will replace (ie override) calls to any other methods
with a target base class
For example if you have @ChildrenOf method targeting Animal, and another
method targeting Cat, then by default both sets of resources will be combined
to produce children for a source object of Cat.
|
public abstract boolean allowChildLookups
public abstract boolean override