Package org.jtool.srcmodel
Class JavaPackage
java.lang.Object
org.jtool.srcmodel.JavaPackage
An object representing a package.
-
Method Summary
Modifier and TypeMethodDescriptionstatic JavaPackage
Creates a new object representing a package.static JavaPackage
createDefault
(JavaFile jfile) Creates a new object representing a default package.static JavaPackage
createExternal
(org.eclipse.jdt.core.dom.IPackageBinding pbinding, JavaProject jproject) Creates a new object representing a package used in a class not having its corresponding file.boolean
boolean
equals
(JavaPackage jpackage) Tests if a given package is equal to this package.Obtains packages containing classes that use classes belonging to this package.org.eclipse.jdt.core.dom.ASTNode
Returns the AST node corresponding to this package.Obtains classes belonging to this package.Obtains packages containing classes that are used by classes belonging to this package.getName()
Returns the name of this package.Obtains sorted classes belonging to this package.int
hashCode()
boolean
Tests if this is default package.boolean
Tests if this package exists inside the target project, which can resent the corresponding source code.toString()
Obtains information on this package.
-
Method Details
-
createDefault
Creates a new object representing a default package. This constructor is not intended to be invoked by clients.- Parameters:
jfile
- the file declaring this package- Returns:
- the created package
-
create
Creates a new object representing a package. This constructor is not intended to be invoked by clients.- Parameters:
node
- an AST node for this packagejfile
- a file that declares this package- Returns:
- the created package
-
createExternal
public static JavaPackage createExternal(org.eclipse.jdt.core.dom.IPackageBinding pbinding, JavaProject jproject) Creates a new object representing a package used in a class not having its corresponding file. This constructor is not intended to be invoked by clients.- Parameters:
pbinding
- the package binding for this packagejproject
- a project which this package is used in- Returns:
- the created package
-
getASTNode
public org.eclipse.jdt.core.dom.ASTNode getASTNode()Returns the AST node corresponding to this package.- Returns:
- the corresponding AST node
-
getName
Returns the name of this package.- Returns:
- the package name
-
isInProject
public boolean isInProject()Tests if this package exists inside the target project, which can resent the corresponding source code.- Returns:
true
if this package exists inside the target project, otherwisefalse
-
isDefault
public boolean isDefault()Tests if this is default package.- Returns:
true
if this is default package, otherwisefalse
-
getClasses
Obtains classes belonging to this package.- Returns:
- the collection of the belonging classes
-
getSortedClasses
Obtains sorted classes belonging to this package.- Returns:
- the sorted collection of the belonging classes
-
equals
-
equals
Tests if a given package is equal to this package.- Parameters:
jpackage
- the package to be checked- Returns:
- the
true
if the given package is equal to this package
-
hashCode
public int hashCode() -
toString
Obtains information on this package. -
getEfferentJavaPackages
Obtains packages containing classes that are used by classes belonging to this package.- Returns:
- the collection of the used packages, or an empty set if there is no file for this package
-
getAfferentJavaPackages
Obtains packages containing classes that use classes belonging to this package.- Returns:
- the collection of the using packages, or an empty set if there is no file for this package
-