Interface CodePackage
- All Superinterfaces:
CodeContainer, CodeElement, CodeItem, CodeItemWithComment, CodeItemWithQualifiedName, CodeItemWithQualifiedNameAndParentPackage, CodeMutable, CodeMutableItem, CodeMutableItemWithComment, CodeNode, CodeNodeItem, CodeNodeItemCopyable<CodeNode, CodePackage>, CodeNodeWithFileWriting, CodePathElement, CodeWithContext
public interface CodePackage
extends CodePathElement, CodeContainer, CodeNodeWithFileWriting, CodeNodeItemCopyable<CodeNode, CodePackage>
CodeElement representing a Package (or similar namespace concept in case of other language).- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
Field Summary
Fields inherited from interface CodeItem
DEFAULT_INDENT, DEFAULT_NEWLINE -
Method Summary
Methods inherited from interface CodeElement
getAnnotations, getDoc, removeFromParentMethods inherited from interface CodeItem
getLanguage, getSourceCode, write, write, write, write, write, writeMethods inherited from interface CodeItemWithComment
getCommentMethods inherited from interface CodeItemWithQualifiedName
getSimpleNameMethods inherited from interface CodeItemWithQualifiedNameAndParentPackage
getParentPackage, getQualifiedNameMethods inherited from interface CodeMutable
isImmutable, isMutableMethods inherited from interface CodeMutableItem
setImmutableMethods inherited from interface CodeMutableItemWithComment
setCommentMethods inherited from interface CodeNodeItemCopyable
copyMethods inherited from interface CodeNodeWithFileWriting
write, writeMethods inherited from interface CodePathElement
isFileMethods inherited from interface CodeWithContext
getContext, getSource
-
Method Details
-
getParent
CodeContainer getParent()- Specified by:
getParentin interfaceCodeNode- Specified by:
getParentin interfaceCodeNodeItemCopyable<CodeNode, CodePackage>- Specified by:
getParentin interfaceCodePathElement- Returns:
- the parent of this
CodeNode. May only benullfor instances ofCodeContext.
-
getChildren
CodePathElements getChildren()- Returns:
- the
CodePathElementscontaining the childCodePackages andCodeFiles of this package.
-
isRequireImport
boolean isRequireImport()- Returns:
trueif this a regular package that requires animport,falseotherwise (in case of a standard package that is always visible such as "{java.lang" for Java).
-
isRoot
boolean isRoot()- Returns:
trueif this is the root package (called "default package" in Java),falseotherwise.
-
getReflectiveObject
Package getReflectiveObject()- Specified by:
getReflectiveObjectin interfaceCodeMutableItem- Returns:
- the optional reflective object of this item such as
Class. May benull(e.g. if this object was created from source-code only or has been created dynamically). However, if available it can be helpful for analysis especially in case of type-safeAnnotationprocessing. In most cases the generic type will be derived fromAnnotatedElementbut in specific cases it can also beProtectionDomainor other types that have no common parent-type. Therefore this generic type is unbounded here.
-
copy
CodePackage copy()- Specified by:
copyin interfaceCodeElement- Specified by:
copyin interfaceCodeMutableItem- Specified by:
copyin interfaceCodeNodeItem- Specified by:
copyin interfaceCodeNodeItemCopyable<CodeNode, CodePackage>- Returns:
- a new
mutablecopy of thisCodeMutableItem. Will be a deep-copy with copies of all childCodeMutableItems.
-