Interface CodeAnnotations
- All Superinterfaces:
CodeItem, CodeMergeableItem<CodeAnnotations>, CodeMutable, CodeMutableItem, CodeNode, CodeNodeContainer<CodeAnnotation>, CodeNodeItem, CodeNodeItemContainer<CodeAnnotation>, CodeNodeItemContainerHierarchical<CodeAnnotation>, CodeNodeItemCopyable<CodeElement, CodeAnnotations>, CodeSimpleMergeableItem<CodeAnnotations>, CodeWithContext, Iterable<CodeAnnotation>
public interface CodeAnnotations
extends CodeNodeItemContainerHierarchical<CodeAnnotation>, CodeSimpleMergeableItem<CodeAnnotations>, CodeNodeItemCopyable<CodeElement, CodeAnnotations>
CodeNodeItemContainerHierarchical containing CodeAnnotations.- 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
Modifier and TypeMethodDescriptionvoidadd(CodeAnnotation annotation) copy()Iterable<? extends CodeAnnotation> getAll()Attention:
This method can be expensive as it has to traverse inherited elements.getDeclared(CodeType type) default CodeAnnotationgetDeclaredOrAdd(CodeType type) Methods inherited from interface CodeItem
getLanguage, getSourceCode, write, write, write, write, write, writeMethods inherited from interface CodeMutable
isImmutable, isMutableMethods inherited from interface CodeMutableItem
getReflectiveObject, setImmutableMethods inherited from interface CodeNodeContainer
getDeclared, isEmpty, iteratorMethods inherited from interface CodeNodeItemContainer
copy, removeMethods inherited from interface CodeNodeItemCopyable
copyMethods inherited from interface CodeSimpleMergeableItem
merge, mergeMethods inherited from interface CodeWithContext
getContext, getSourceMethods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
getParent
CodeElement getParent()- Specified by:
getParentin interfaceCodeNode- Specified by:
getParentin interfaceCodeNodeItemContainer<CodeAnnotation>- Specified by:
getParentin interfaceCodeNodeItemCopyable<CodeElement, CodeAnnotations>- Returns:
- the parent of this
CodeNode. May only benullfor instances ofCodeContext.
-
getAll
Iterable<? extends CodeAnnotation> getAll()Attention:
This method can be expensive as it has to traverse inherited elements. However, due to the usage ofIterableimplementations can lazily traverse.- Specified by:
getAllin interfaceCodeNodeItemContainerHierarchical<CodeAnnotation>- Returns:
- the
Iterableof allCodeItems as the union of thedeclaredand its recursively traversed items. May beemptybut is nevernull. - See Also:
-
add
- Parameters:
type- thetypereflecting theannotation.- Returns:
- the new
CodeAnnotationthat has been created and added.
-
add
- Parameters:
annotation- theCodeAnnotationto add.
-
getDeclared
- Parameters:
type- thetypereflecting theannotation.- Returns:
- the
CodeAnnotationfromCodeNodeContainer.getDeclared()withthe giveCodeTypeornullif not found.
-
getDeclaredOrAdd
- Parameters:
type- thetypereflecting theannotation.- Returns:
- the
CodeAnnotationfromCodeNodeContainer.getDeclared()withthe giveCodeTypeor a newaddedone.
-
copy
CodeAnnotations copy()- Specified by:
copyin interfaceCodeMutableItem- Specified by:
copyin interfaceCodeNodeItem- Specified by:
copyin interfaceCodeNodeItemContainer<CodeAnnotation>- Specified by:
copyin interfaceCodeNodeItemContainerHierarchical<CodeAnnotation>- Specified by:
copyin interfaceCodeNodeItemCopyable<CodeElement, CodeAnnotations>- Returns:
- a new
mutablecopy of thisCodeMutableItem. Will be a deep-copy with copies of all childCodeMutableItems.
-