Package spoon.reflect.factory
Class PackageFactory
java.lang.Object
spoon.reflect.factory.SubFactory
spoon.reflect.factory.PackageFactory
The
CtPackage
sub-factory.-
Field Summary
Fields inherited from class spoon.reflect.factory.SubFactory
factory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new package (see alsogetOrCreate(String)
).createPackageDeclaration(CtPackageReference packageRef)
Creates a package declaration of a package.createReference(Package pack)
Creates a reference to a package by using its Java runtime representation.createReference(String name)
Creates a reference to a package.createReference(CtPackage pack)
Creates a reference to an existing package.Gets a package.getAll()
Gets the list of all created packages.getOrCreate(String qualifiedName)
Gets or creates a package for the unnamed modulegetOrCreate(String qualifiedName, CtModule rootModule)
Gets or creates a package and make its parent the given moduleReturn the unnamed top-level package.topLevel()
Returns a reference on the top level package.
-
Constructor Details
-
PackageFactory
Creates a new package sub-factory.- Parameters:
factory
- the parent factory
-
-
Method Details
-
createReference
Creates a reference to an existing package. The simple name of the reference will be the FQN of the given package -
createReference
Creates a reference to a package by using its Java runtime representation. The simple name of the reference will be the FQN of the given package- Parameters:
pack
- a runtime package- Returns:
- reference to the package
-
topLevel
Returns a reference on the top level package. -
createReference
Creates a reference to a package. The given name has to be a fully qualified name.- Parameters:
name
- full name of the package to reference
-
createPackageDeclaration
Creates a package declaration of a package.- Parameters:
packageRef
- a reference to a package
-
create
Creates a new package (see alsogetOrCreate(String)
).- Parameters:
parent
- the parent package (can be null)simpleName
- the package's simple name (no dots)- Returns:
- the newly created package
-
getOrCreate
Gets or creates a package for the unnamed module- Parameters:
qualifiedName
- the full name of the package
-
getOrCreate
Gets or creates a package and make its parent the given module- Parameters:
qualifiedName
- the full name of the packagerootModule
- The parent module of the package
-
get
Gets a package.- Parameters:
qualifiedName
- the package to search- Returns:
- a found package or null
-
getAll
Gets the list of all created packages. It includes all the top-level packages and their sub-packages. -
getRootPackage
Return the unnamed top-level package.
-