JvmModelInferrer - Generate a method call [message #1765379] |
Thu, 08 June 2017 20:58  |
Eclipse User |
|
|
|
Hello,
I am trying to write a small DSL which generates a Java Class. Within this class, I would like to add something like this
public static final Logger LOG = LoggerFactory.getLogger(blah.class);
I know how to generate ' LOG' filed using jvmtype builder toField API.
I also know that I can also write a setInitializer to initialize this field
typeBuilder.setInitializer(logger, appendable -> {
appendable.append("LoggerFactory.getLogger(");
appendable.append("blah");
appendable.append(".class)");
});
However this does not cause the import of LoggerFactory.
I am wondering how can achieve the same result with Model Inferrer recognizing the LoggerFactory type and generating a import statement for that?
Thanks
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05350 seconds