问题
I am writing a java class and would like to return a coldfusion struct from a method. Struct extends Map and other things. I'm not a Java programmer, so I'm not sure how to fix this. Here's the lucee java docs.
When I try to compile the following code, I get an error saying that Struct is abstract and can't be instantiated (on the line when I try to create myStruct). I've tried to create a new Map, but that's also abstract.
import lucee.runtime.type;
public class MyClass {
public lucee.runtime.type.Struct test () {
// I was hoping to do this, but I get an error
lucee.runtime.type.Struct myStruct = new lucee.runtime.type.Struct();
myStruct.put("passed", true);
return(myStruct);
} // test()
}
来源:https://stackoverflow.com/questions/39670241/how-do-i-return-a-coldfusion-struct-from-a-method-in-a-java-class-in-lucee