class Foo { String baz static Foo create(String foo) { return new Foo(baz: 'String FOO') } static Foo create(Integer foo) { return new Foo(baz: 'integer FOO') } //static Foo create(Object foo) { // return new Foo(baz: 'object FOO') //} } Foo.create(false).baz