Skip to content

Instantly share code, notes, and snippets.

@olafgeibig
Created January 17, 2013 09:59
Show Gist options
  • Save olafgeibig/4554972 to your computer and use it in GitHub Desktop.
Save olafgeibig/4554972 to your computer and use it in GitHub Desktop.
Java:
String getDescription() {
StringBuilder stringBuilder = new StringBuilder();
if(titel != null && titel.length() > 0){
stringBuilder.append(titel).append(',')
}
if(vorname != null && vorname.length() > 0){
stringBuilder.append(vorname).append(',')
}
if(nachname != null && nachname.length() > 0){
stringBuilder.append(nachname).append(',')
}
if(typ != null && typ.length() > 0){
stringBuilder.append(typ).append(',')
}
if(standorte != null && standorte.size() > 0){
stringBuilder.append(standorte.get(0))
}
return stringBuilder.toString()
}
Groovy:
String getDescription() {
[titel, vorname, nachname, typ, adressen ? adressen[0]?.ort : null].findAll{ StringUtils.isNotBlank(it) }.join(',')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment