Groovy web console

subscribe to the feed Subscribe
to this
site

ToString annotation and getter methods

Published 5 months ago by Marcin with tags toString
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.transform.ToString

@ToString(includeNames = true, excludes = ['password', 'credentialsString'])
class Credentials {

String login
String password


String getCredentialsString() {
    login + ";" + password
}

}

new Credentials(login: 'me', password: 'secret')