Groovy web console

subscribe to the feed Subscribe
to this
site

private fields with generated getters/setters

Published 2 months ago by william
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class AdvancePhaseOptions {
  private boolean force, retry
  String toString() { "AdvancePhaseOptions(force=${force},retry=${retry})" }
}

def opts = new AdvancePhaseOptions(force:true,retry:false)
println(opts)
opts.setForce(false)
println(opts)