Search Results

Search found 1 results on 1 pages for 'antarti'.

Page 1/1 | 1 

  • CodeModel help needed for right-hand singleton.getinstance() assignment.

    - by antarti
    I've been able to generate 99% of what I need with the CodeModel API, but I am stumped here... Using the various "directXX" methods does not add import statements to the generated code, and I can work without the "directXXX" type of methods except for one place in a generated class. Suppose I desire a generated method like: /** * Copies data from this Value-Obj instance, to the returned PERSON instance. * * @return PERSON * */ public PERSON mapVOToPERSON() throws MappingException { Mapper mapper = (com.blah.util.MapperSingleton.getMapperInstance()); return mapper.map(this, PERSON.class); } You can see the right hand of the Mapper assignment in parens. Emitting the entire package+class was the only way I could find to just declare "SomeSingleton.someMethod()" on the right hand side and have the generated code compile. Without the MapperSingleton being added to the object model, there is no import generated... Questions: 1) Is there a way to force an import to be generated? 2) How to declare an expression that gives me the right side of the Mapper assignment within the object model (so that an import of MapperSingleton gets generated. Any help appreciated...

    Read the article

1