|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.rej.Imports
public class Imports
Handles creation of import statements (for improved readability) and the conversion between FQNs and short names of types, taking in consideration naming conflicts. This is a purely logical class used by the user interface classes to guide in the presentation of import statements and full/short names of types.
| Constructor Summary | |
|---|---|
Imports(java.lang.String homePackage)
Initializes this Imports object setting homePackage
as the home of this object. |
|
| Method Summary | |
|---|---|
void |
addType(java.lang.String fullTypeName)
Adds the FQN given as parameter to this import set. |
static boolean |
areInSamePackage(java.lang.String type1,
java.lang.String type2)
Return a boolean value indicating whether or not the two given fully qualified names are in th same package or not. |
java.util.Set<java.lang.String> |
getImports()
Returns a list of import statements for this imports object. |
static java.lang.String |
getPackage(java.lang.String type)
Returns the package portion of the given FQN or an empty
String if the FQN contains no package definition. |
java.lang.String |
getShortName(java.lang.String fqn)
Returns the "short name" for the type. |
static java.lang.String |
getType(java.lang.String type)
Returns the short name of the given FQN. |
static boolean |
isInDefaultPackage(java.lang.String type)
Returns a boolean value indicating whether or not the given FQN of a type is in the default package (in other words, has no package definition). |
static boolean |
isInJavaLang(java.lang.String type)
Returns a boolean value indicating whether or not the given FQN of a type is in the java.lang package or not. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Imports(java.lang.String homePackage)
Imports object setting homePackage
as the home of this object. No import statements are created
for types in the home package.
homePackage - the home package, for example: "com.mycompany.myproject"| Method Detail |
|---|
public void addType(java.lang.String fullTypeName)
fullTypeName - the fully qualified name of the type to add
to this import object.public java.util.Set<java.lang.String> getImports()
public static java.lang.String getPackage(java.lang.String type)
String if the FQN contains no package definition.
type - a FQN of a class.
public static java.lang.String getType(java.lang.String type)
type - a FQN of a type.
public static boolean isInDefaultPackage(java.lang.String type)
type - a fully qualified name of a type.
public static boolean isInJavaLang(java.lang.String type)
java.lang package or not.
type - a fully qualified name of a type.
java.lang package.
public static boolean areInSamePackage(java.lang.String type1,
java.lang.String type2)
type1 - the first type to compare.type2 - the second type to compare.
java.lang.Object and java.lang.String).public java.lang.String getShortName(java.lang.String fqn)
java.lang.String the short name would be
String. If the import object judges that shortening
the name would be risking ambiguity, the full name is returned
instead.
fqn - the FQN of the class to be shortened.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||