I have a java class which I'm trying to instantiate.
PackageGenerator gen = [
fileName: "file.xml",
platform: "windows",
version: "1.0"]
println ReflectionToStringBuilder.toString(gen);
produce:
PackageGenerator_groovyProxy[fileName=<null>, platform=<null>, version=<null>]
but if I write it with the .with way:
PackageGenerator gen = new PackageGenerator()
gen.with {
fileName = "file.xml"
platform = "windows"
version = "1.0"
}
println ReflectionToStringBuilder.toString(gen);
produces:
PackageGenerator[fileName="file.xml", platform="windows", version="1.0"]
what's causing the groovy proxy class to be used instead of the actual class?