Skip to content

Instantly share code, notes, and snippets.

@vkoloss
Created June 1, 2016 10:45
Show Gist options
  • Select an option

  • Save vkoloss/f346eba74eea0d515f7184cf583b33fb to your computer and use it in GitHub Desktop.

Select an option

Save vkoloss/f346eba74eea0d515f7184cf583b33fb to your computer and use it in GitHub Desktop.
import groovy.transform.EqualsAndHashCode
@EqualsAndHashCode(includeFields=true)
public class Person {
String name;
String lastName;
@Delegate
List<String> expertises = [];
def getFullName() {
"$name $lastName"
}
def getCommaSeparated() {
expertises.join(', ')
}
}
p.metaClass.removeJTech = { ->
delegate.expertises.removeAll {
it.charAt(0) == 'j'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment