Interface CodeMutable

All Known Subinterfaces:
CodeAnnotation, CodeAnnotations, CodeArrayType, CodeBlock, CodeBlockBody, CodeBlockDoWhile, CodeBlockFor, CodeBlockIf, CodeBlockInitializer, CodeBlockStatement, CodeBlockWhileDo, CodeBlockWithCondition, CodeComposedType, CodeConstructor, CodeConstructors, CodeDoc, CodeElement, CodeElementWithDeclaringType, CodeElementWithModifiers, CodeElementWithName, CodeElementWithTypeVariables, CodeException, CodeExceptions, CodeField, CodeFields, CodeFile, CodeFunction, CodeGenericType, CodeGenericTypeParameters<P>, CodeImports, CodeLambdaExpression, CodeMember, CodeMembers<M>, CodeMethod, CodeMethods, CodeMutableItem, CodeMutableItemWithComment, CodeMutableItemWithQualifiedName, CodeMutableItemWithType, CodeNestedTypes, CodeNodeItem, CodeNodeItemContainer<I>, CodeNodeItemContainerFlat<I>, CodeNodeItemContainerFlatWithName<I>, CodeNodeItemContainerHierarchical<I>, CodeNodeItemContainerHierarchicalWithName<I>, CodeNodeItemContainerWithName<I>, CodeNodeItemCopyable<P,SELF>, CodeNodeItemWithDeclaringMember, CodeOperation, CodeOperationArg, CodeOperationArgs<A>, CodeOperations<O>, CodePackage, CodeParameter, CodeParameterizedType, CodeParameters, CodePathElement, CodePathElements, CodeProperties, CodeProperty, CodeReturn, CodeSource, CodeSuperTypes, CodeType, CodeTypeParameters, CodeTypePlaceholder, CodeTypeVariable, CodeTypeVariables, CodeTypeWildcard

public interface CodeMutable
A code object that can be mutable or immutable.
Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    By default a CodeNode retrieved from an existing source (e.g. via CodeLoader.getType(String)) is immutable.
    default boolean
     
  • Method Details

    • isImmutable

      boolean isImmutable()
      By default a CodeNode retrieved from an existing source (e.g. via CodeLoader.getType(String)) is immutable. Use an according edit() method to get a new mutable copy of the object before you do any changes. A newly created CodeItem will however always be mutable. In case a CodeMutable object is immutable, all setter methods will throw a ReadOnlyException and all Collections returned by getters will be unmodifiable.
      Returns:
      true if this item itself (not the reflected code) is immutable and can not be edited (setters may be called without getting exceptions), false otherwise (if mutable).
    • isMutable

      default boolean isMutable()
      Returns:
      true if mutable (not immutable)