Package spoon.reflect.declaration
Interface CtPackageExport
- All Superinterfaces:
Cloneable
,CtElement
,CtModuleDirective
,CtQueryable
,CtVisitable
,FactoryAccessor
,Serializable
,SourcePositionHolder
- All Known Implementing Classes:
CtPackageExportImpl
Represents an exported or opened package in a Java module
The exports directive specifies the name of a package to be exported by the current module.
For code in other modules, this grants access at compile time and run time to the public and protected types in the package,
and the public and protected members of those types. It also grants reflective access to those types and members for code in other modules.
The opens directive specifies the name of a package to be opened by the current module.
For code in other modules, this grants access at run time, but not compile time, to the public and protected types in the package,
and the public and protected members of those types. It also grants reflective access to all types in the package, and all their members, for code in other modules.
It is permitted for opens to specify a package which is not declared by a compilation unit associated with the current module.
(If the package should happen to be declared by an observable compilation unit associated with another module, the opens directive has no effect on that other module.)
If an exports or opens directive has a to clause, then the directive is qualified; otherwise, it is unqualified.
For a qualified directive, the public and protected types in the package, and their public and protected members, are accessible solely to code in the modules specified in the to clause.
The modules specified in the to clause are referred to as friends of the current module. For an unqualified directive, these types and their members are accessible to code in any module.
It is permitted for the to clause of an exports or opens directive to specify a module which is not observable (ยง7.7.6).
Examples:
exports com.example.foo.internal to com.example.foo.probe; opens com.example.foo.quux;
-
Method Summary
Modifier and TypeMethodDescription<T extends CtPackageExport>
TaddTargetExport(CtModuleReference targetExport)
clone()
Clone the element which calls this method in a new object.boolean
<T extends CtPackageExport>
TsetOpenedPackage(boolean openedPackage)
<T extends CtPackageExport>
TsetPackageReference(CtPackageReference packageReference)
<T extends CtPackageExport>
TsetTargetExport(List<CtModuleReference> targetExport)
Methods inherited from interface spoon.reflect.declaration.CtElement
addAnnotation, addComment, asIterable, delete, descendantIterator, getAllMetadata, getAnnotatedChildren, getAnnotation, getAnnotation, getAnnotations, getComments, getDirectChildren, getDocComment, getElements, getMetadata, getMetadataKeys, getOriginalSourceFragment, getParent, getParent, getParent, getPath, getPosition, getReferencedTypes, getRoleInParent, getShortRepresentation, getValueByRole, hasAnnotation, hasParent, isImplicit, isParentInitialized, prettyprint, putMetadata, removeAnnotation, removeComment, replace, replace, setAllMetadata, setAnnotations, setComments, setDocComment, setImplicit, setParent, setPosition, setPositions, setValueByRole, toString, toStringDebug, updateAllParentsBelow
Methods inherited from interface spoon.reflect.visitor.chain.CtQueryable
filterChildren, map, map
Methods inherited from interface spoon.reflect.visitor.CtVisitable
accept
Methods inherited from interface spoon.processing.FactoryAccessor
getFactory, setFactory
-
Method Details
-
setOpenedPackage
-
isOpenedPackage
boolean isOpenedPackage() -
getPackageReference
CtPackageReference getPackageReference() -
setPackageReference
-
getTargetExport
List<CtModuleReference> getTargetExport() -
setTargetExport
-
addTargetExport
-
clone
CtPackageExport clone()Description copied from interface:CtElement
Clone the element which calls this method in a new object. Note that that references are kept as is, and thus, so if you clone whole classes or methods, some parts of the cloned element (eg executable references) may still point to the initial element. In this case, consider using methodsRefactoring.copyType(CtType)
andRefactoring.copyMethod(CtMethod)
instead which does additional work beyond cloning.
-