Skip to content

Instantly share code, notes, and snippets.

@liviutudor
Last active September 22, 2017 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liviutudor/afc80149cc22b1e37af10ea692bb8ca9 to your computer and use it in GitHub Desktop.
Save liviutudor/afc80149cc22b1e37af10ea692bb8ca9 to your computer and use it in GitHub Desktop.
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