Class AddImport<P>


  • public class AddImport<P>
    extends JavaIsoVisitor<P>
    A Java refactoring visitor that can be used to add an import (or static import) to a given compilation unit. This visitor can also be configured to only add the import if the imported class/method are referenced within the compilation unit.

    The type must be supplied and represents a fully qualified class name.

    The statik is an optional method within the imported type. The staticMethod can be set to "*" to represent a static wildcard import.

    The onlyIfReferenced is a flag (defaulted to true) to indicate if the import should only be added if there is a reference to the imported class/method.