Interface DeepCopyable<T>

Type Parameters:
T - the type of the subtype of DeepCopyable
All Known Implementing Classes:
AnnotatedTypeMirror, AnnotatedTypeMirror.AnnotatedArrayType, AnnotatedTypeMirror.AnnotatedDeclaredType, AnnotatedTypeMirror.AnnotatedExecutableType, AnnotatedTypeMirror.AnnotatedIntersectionType, AnnotatedTypeMirror.AnnotatedNoType, AnnotatedTypeMirror.AnnotatedNullType, AnnotatedTypeMirror.AnnotatedPrimitiveType, AnnotatedTypeMirror.AnnotatedTypeVariable, AnnotatedTypeMirror.AnnotatedUnionType, AnnotatedTypeMirror.AnnotatedWildcardType, AnnotationMirrorSet, WholeProgramInferenceJavaParserStorage.CallableDeclarationAnnos

public interface DeepCopyable<T>
An interface for types that implement the deepCopy() method.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a deep copy of this.
    static <T extends @Nullable DeepCopyable<T>>
    @PolyNull T
    Returns the deep copy of a non-null argument, or null for a null argument.
  • Method Details

    • deepCopy

      T deepCopy()
      Returns a deep copy of this. A deep copy is equal to the original, but side effects to either object are not visible in the other. A deep copy may share immutable state with the original.

      The run-time class of the result is identical to the run-time class of this. The deep copy is equal to this (per equals() if the object's class does not use reference equality as Object.equals() does).

      Returns:
      a deep copy of this
    • deepCopyOrNull

      static <T extends @Nullable DeepCopyable<T>> @PolyNull T deepCopyOrNull(@PolyNull T object)
      Returns the deep copy of a non-null argument, or null for a null argument.
      Type Parameters:
      T - the type of the object
      Parameters:
      object - object to copy
      Returns:
      the deep copy of a non-null argument, or null for a null argument