3

I want to generate a file containing a reference to a class without knowing which package it actually comes from.

E.g. the user supplies

import foo.*
import blah.*

Button("press me")

and I need to generate

import foo.*;
import blah.*;

public class MyWindow extends Window {
    public MyWindow() {
        Button button = new Button();
        button.setLabel("press me");
    }
}

The class Button can be in either package. Is this sort of scenario supported by CodeModel? The examples at CodeModel help needed for right-hand singleton.getinstance() assignment and A Java API to generate Java source files specify complete package names for classes, and a look at the JavaDoc didn't help.

Community
  • 1
  • 1
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
  • 1
    may be this helps http://stackoverflow.com/questions/4851937/codemodel-help-needed-for-right-hand-singleton-getinstance-assignment – sherif Jul 13 '11 at 15:26

0 Answers0