Parent Object Definitions
Thanks to Phill Nacelli, you can reuse object definitions in your binder or via annotations. This means that you can declare an object with its dependencies and then create other definitions that use all of this parent object's definitions. This saves tons of time in declarations and provides you with great reusability.
1
// Binder method
2
parent(alias);
3
4
// Parent Annotation
5
component parent="alias"{}
Copied!
Here is a small example:
1
// PARENT Mappings
2
map("AbstractService").to("model.AbstractService");
3
.property(name:"someAlphaDAO", ref:"someAlphaDAO")
4
.property(name:"someBravoDAO", ref:"someBravoDAO");
5
6
// Concrete service with parent and also some added dpendencies of its own
7
map("ConcreteService").to("#myPath#.parent.SomeConcreteService")
8
.parent("AbstractService")
9
.property(name:"someCharlieDAO", ref:"someCharlieDAO")
10
.property(name:"someDeltaDAO", ref:"someDeltaDAO");;
Copied!
Copy link