Interface CodeMethods
- All Superinterfaces:
CodeAdvancedMergeableItem<CodeMethods>, CodeItem, CodeItemWithDeclaringType, CodeMembers<CodeMethod>, CodeMergeableItem<CodeMethods>, CodeMutable, CodeMutableItem, CodeNode, CodeNodeContainer<CodeMethod>, CodeNodeItem, CodeNodeItemContainer<CodeMethod>, CodeNodeItemContainerHierarchical<CodeMethod>, CodeNodeItemCopyable<CodeType, CodeMethods>, CodeOperations<CodeMethod>, CodeWithContext, Iterable<CodeMethod>
public interface CodeMethods
extends CodeOperations<CodeMethod>, CodeNodeItemContainerHierarchical<CodeMethod>, CodeAdvancedMergeableItem<CodeMethods>, CodeNodeItemCopyable<CodeType, CodeMethods>
CodeMembers as a container for the CodeMethods.- 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 TypeMethodDescriptioncopy()getDeclared(String name, CodeGenericType... parameterTypes) default CodeMethoddefault CodeMethodgetFirstOrCreate(String name) Methods inherited from interface CodeAdvancedMergeableItem
merge, merge, mergeMethods inherited from interface CodeItem
getLanguage, getSourceCode, write, write, write, write, write, writeMethods inherited from interface CodeItemWithDeclaringType
getDeclaringTypeMethods inherited from interface CodeMembers
add, getParentMethods 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 CodeNodeItemContainerHierarchical
getAllMethods inherited from interface CodeNodeItemCopyable
copy, getParentMethods inherited from interface CodeOperations
getMethods inherited from interface CodeWithContext
getContext, getSourceMethods inherited from interface Iterable
forEach, spliterator
-
Method Details
-
getDeclared
- Parameters:
name- thenameof the requestedCodeOperation.parameterTypes- theCodeGenericTypes of theparameters.- Returns:
- the requested
CodeOperationornullif not found.
-
add
- Parameters:
name- themethod name.- Returns:
- a new
CodeMethodthat has been added toCodeNodeContainer.getDeclared(). Thereturn typewill be initialized asvoid. It will not have anyparametersorexceptions. Simply add those afterwards as needed. - Throws:
io.github.mmm.base.exception.ReadOnlyException- ifimmutable.
-
getFirst
- Parameters:
name- themethod name.- Returns:
- the first
CodeMethodwith the givennamethat has been found ornullif no such method exists. Please note that languages such as Java can have many methods with the same name. In such case it is unspecified which of these methods is returned. However, for convenience this method can be handy to find getters, setters, hashCode, etc.
-
getFirstOrCreate
- Parameters:
name- themethod name.- Returns:
- the
firstCodeMethodwith the givennamethat has been found or anewly added oneif no such method exists. Please note that languages such as Java can have many methods with the same name. In such case it is unspecified which of these methods is returned.
-
copy
CodeMethods copy()- Specified by:
copyin interfaceCodeMembers<CodeMethod>- Specified by:
copyin interfaceCodeMutableItem- Specified by:
copyin interfaceCodeNodeItem- Specified by:
copyin interfaceCodeNodeItemContainer<CodeMethod>- Specified by:
copyin interfaceCodeNodeItemContainerHierarchical<CodeMethod>- Specified by:
copyin interfaceCodeNodeItemCopyable<CodeType, CodeMethods>- Specified by:
copyin interfaceCodeOperations<CodeMethod>- Returns:
- a new
mutablecopy of thisCodeMutableItem. Will be a deep-copy with copies of all childCodeMutableItems.
-