Interface CodeFile
- All Superinterfaces:
CodeElement, CodeItem, CodeItemWithComment, CodeItemWithQualifiedName, CodeItemWithQualifiedNameAndParentPackage, CodeMutable, CodeMutableItem, CodeMutableItemWithComment, CodeNode, CodeNodeItem, CodeNodeItemCopyable<CodePackage, CodeFile>, CodeNodeWithFileWriting, CodePathElement, CodeWithContext
public interface CodeFile
extends CodePathElement, CodeNodeWithFileWriting, CodeNodeItemCopyable<CodePackage, CodeFile>
Abstract top-level interface for any item of code as defined by this API. It reflects code structure.
- 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
getParentMethods inherited from interface CodeNodeWithFileWriting
write, writeMethods inherited from interface CodePathElement
getParent, isFileMethods inherited from interface CodeWithContext
getContext, getSource
-
Method Details
-
getExtension
String getExtension()- Returns:
- the file extension including the dot (e.g. ".java").
-
getType
- Returns:
- the main type contained in this file.
-
getTypes
-
getImports
CodeImports getImports()- Returns:
- the
CodeImportscontaining theCodeImports. May beemptybut is nevernull.
-
getReflectiveObject
Class<?> 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
CodeFile copy()- Specified by:
copyin interfaceCodeElement- Specified by:
copyin interfaceCodeMutableItem- Specified by:
copyin interfaceCodeNodeItem- Specified by:
copyin interfaceCodeNodeItemCopyable<CodePackage, CodeFile>- Returns:
- a new
mutablecopy of thisCodeMutableItem. Will be a deep-copy with copies of all childCodeMutableItems.
-
copy
- Specified by:
copyin interfaceCodeMutableItem- Specified by:
copyin interfaceCodeNodeItem- Specified by:
copyin interfaceCodeNodeItemCopyable<CodePackage, CodeFile>- Parameters:
mapper- theCodeCopyMapperused to map involved nodes during copy.- Returns:
- a
CodeMutableItem.copy()with the related objects mapped using the givenCodeCopyMapper.
-