Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Aggregation 2 classes with @Delegate
class DelegationBean {
@Delegate
BeanOne person
@Delegate
BeanTwo dateOfBirth
static void main(String... args) {
DelegationBean one = new DelegationBean(person: new BeanOne("Liviu", "Tudor"), dateOfBirth: new BeanTwo(yob: 1975))
DelegationBean two = new DelegationBean(person: new BeanOne("William", "Shakespeare"), dateOfBirth: new BeanTwo(yob: 1564))
println one.fullName
println two.fullName
println(one < two)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment