org.nuiton.eugene.java
Class ImportsManager

java.lang.Object
  extended by org.nuiton.eugene.java.ImportsManager

Deprecated. since 2.3, use now the class ImportsManager

@Deprecated
public class ImportsManager
extends Object

Class used in generators that allows to manage easily imports. A first-pass allow to register imports, and in a second-pass, returns the type to use in generated code.

Since:
2.0.0
Version:
$Revision: 1020 $
Author:
thimel, chemit

Constructor Summary
ImportsManager()
          Deprecated.  
 
Method Summary
 boolean addImport(Class<?> clazz)
          Deprecated. From the given class, add it to the imports list.
 boolean addImport(String fqn)
          Deprecated. From the given fqn (fully qualified name), add it to the imports list.
 void clearImports()
          Deprecated. Method to reset imports list.
 List<String> getImports(String packageName)
          Deprecated. List the imports.
 String getType(String fqn)
          Deprecated. Accorging to the already added types, returns the type to write in file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImportsManager

public ImportsManager()
Deprecated. 
Method Detail

addImport

public boolean addImport(Class<?> clazz)
Deprecated. 
From the given class, add it to the imports list.

Parameters:
clazz - the class to import
Returns:
true if import add was successful
See Also:
addImport(String)

addImport

public boolean addImport(String fqn)
Deprecated. 
From the given fqn (fully qualified name), add it to the imports list. If there is a conflict adding this import, will return false. If reading of the imports has started, this method will return false, unless type does not need to be imported.

Parameters:
fqn - the fully qualified name to import
Returns:
true if import add was successful

getType

public String getType(String fqn)
Deprecated. 
Accorging to the already added types, returns the type to write in file. If there is a conflict, returns the fully qualified name, otherwise returns the simple name

Parameters:
fqn - the fully qualified name to add
Returns:
the fqn or simple name according to in-place imports

getImports

public List<String> getImports(String packageName)
Deprecated. 
List the imports. This method will remove the useless imports according to the given packageName (no need to import a class in the same package)

Parameters:
packageName - the current package name (to avoid useless imports)
Returns:
the imports alphabeticaly sorted

clearImports

public void clearImports()
Deprecated. 
Method to reset imports list. If imports has been listed, it becomes back possible to add imports.



Copyright © 2004-2010 CodeLutin. All Rights Reserved.