Class ModifyableJavaClass

  • All Implemented Interfaces:
    com.thoughtworks.qdox.model.JavaAnnotatedElement, com.thoughtworks.qdox.model.JavaClass, com.thoughtworks.qdox.model.JavaGenericDeclaration, com.thoughtworks.qdox.model.JavaModel, com.thoughtworks.qdox.model.JavaType, java.io.Serializable

    public class ModifyableJavaClass
    extends com.thoughtworks.qdox.model.impl.AbstractInheritableJavaEntity
    implements com.thoughtworks.qdox.model.JavaClass
    Custom implementation derived from DefaultJavaClass to enable modification of AST.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAllInitializer​(java.util.List<com.thoughtworks.qdox.model.JavaInitializer> initializersList)  
      void addClass​(com.thoughtworks.qdox.model.JavaClass cls)  
      void addConstructor​(com.thoughtworks.qdox.model.JavaConstructor constructor)  
      void addField​(com.thoughtworks.qdox.model.JavaField javaField)  
      void addInitializer​(com.thoughtworks.qdox.model.JavaInitializer initializer)  
      void addMethod​(com.thoughtworks.qdox.model.JavaMethod meth)  
      boolean equals​(java.lang.Object obj)  
      java.util.List<com.thoughtworks.qdox.model.BeanProperty> getBeanProperties()  
      java.util.List<com.thoughtworks.qdox.model.BeanProperty> getBeanProperties​(boolean superclasses)  
      com.thoughtworks.qdox.model.BeanProperty getBeanProperty​(java.lang.String propertyName)  
      com.thoughtworks.qdox.model.BeanProperty getBeanProperty​(java.lang.String propertyName, boolean superclasses)  
      java.lang.String getBinaryName()  
      java.lang.String getCanonicalName()  
      java.lang.String getCodeBlock()  
      com.thoughtworks.qdox.model.JavaClass getComponentType()  
      com.thoughtworks.qdox.model.JavaConstructor getConstructor​(java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes)  
      com.thoughtworks.qdox.model.JavaConstructor getConstructor​(java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes, boolean varArgs)  
      java.util.List<com.thoughtworks.qdox.model.JavaConstructor> getConstructors()  
      java.util.List<com.thoughtworks.qdox.model.JavaClass> getDerivedClasses()  
      int getDimensions()  
      com.thoughtworks.qdox.model.JavaField getEnumConstantByName​(java.lang.String name)  
      java.util.List<com.thoughtworks.qdox.model.JavaField> getEnumConstants()  
      com.thoughtworks.qdox.model.JavaField getFieldByName​(java.lang.String name)  
      java.util.List<com.thoughtworks.qdox.model.JavaField> getFields()  
      java.lang.String getFullyQualifiedName()  
      java.lang.String getGenericCanonicalName()  
      java.lang.String getGenericFullyQualifiedName()  
      java.lang.String getGenericValue()  
      java.util.List<com.thoughtworks.qdox.model.JavaType> getImplements()  
      java.util.List<com.thoughtworks.qdox.model.JavaInitializer> getInitializers()  
      java.util.List<com.thoughtworks.qdox.model.JavaClass> getInterfaces()  
      com.thoughtworks.qdox.library.ClassLibrary getJavaClassLibrary()  
      com.thoughtworks.qdox.model.JavaMethod getMethod​(java.lang.String name, java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes, boolean varArgs)  
      com.thoughtworks.qdox.model.JavaMethod getMethodBySignature​(java.lang.String name, java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes)  
      com.thoughtworks.qdox.model.JavaMethod getMethodBySignature​(java.lang.String name, java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes, boolean superclasses)  
      com.thoughtworks.qdox.model.JavaMethod getMethodBySignature​(java.lang.String name, java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes, boolean superclasses, boolean varArg)  
      java.util.List<com.thoughtworks.qdox.model.JavaMethod> getMethods()  
      java.util.List<com.thoughtworks.qdox.model.JavaMethod> getMethods​(boolean superclasses)  
      java.util.List<com.thoughtworks.qdox.model.JavaMethod> getMethodsBySignature​(java.lang.String name, java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes, boolean superclasses)  
      java.util.List<com.thoughtworks.qdox.model.JavaMethod> getMethodsBySignature​(java.lang.String name, java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes, boolean superclasses, boolean varArg)  
      com.thoughtworks.qdox.model.JavaClass getNestedClassByName​(java.lang.String name)  
      java.util.List<com.thoughtworks.qdox.model.JavaClass> getNestedClasses()  
      com.thoughtworks.qdox.model.JavaPackage getPackage()  
      java.lang.String getPackageName()  
      com.thoughtworks.qdox.model.JavaSource getParentSource()  
      java.lang.String getSimpleName()  
      com.thoughtworks.qdox.model.JavaSource getSource()  
      com.thoughtworks.qdox.model.JavaType getSuperClass()  
      com.thoughtworks.qdox.model.JavaClass getSuperJavaClass()
      Shorthand for getSuperClass().getJavaClass() with null checking.
      java.util.List<com.thoughtworks.qdox.model.DocletTag> getTagsByName​(java.lang.String name, boolean superclasses)  
      java.util.List<ModifyableJavaTypeVariable<com.thoughtworks.qdox.model.JavaClass>> getTypeParameters()  
      java.lang.String getValue()  
      int hashCode()  
      boolean isA​(com.thoughtworks.qdox.model.JavaClass javaClass)  
      boolean isA​(java.lang.String fullClassName)  
      boolean isAnnotation()  
      boolean isArray()  
      boolean isEnum()  
      boolean isInner()  
      boolean isInterface()  
      boolean isPrimitive()  
      boolean isVoid()  
      void removeInitializer​(com.thoughtworks.qdox.model.JavaInitializer initializer)  
      void replace​(com.thoughtworks.qdox.model.JavaConstructor baseConstructor, com.thoughtworks.qdox.model.JavaConstructor patchConstructor)
      Replaces the given baseConstructor with the given patchConstructor.
      void replace​(com.thoughtworks.qdox.model.JavaField baseField, com.thoughtworks.qdox.model.JavaField patchField)
      Replaces the given baseField with the given patchField.
      void replace​(com.thoughtworks.qdox.model.JavaInitializer baseInitializerBlock, com.thoughtworks.qdox.model.JavaInitializer patchInitializerBlock)
      Replaces the given baseInitializer with the given patchInitializer.
      void replace​(com.thoughtworks.qdox.model.JavaMethod baseMethod, com.thoughtworks.qdox.model.JavaMethod patchMethod)
      Replaces the given baseMethod with the given patchMethod.
      void setAnnotation​(boolean anAnnotation)  
      void setEnum​(boolean anEnum)  
      void setImplementz​(java.util.List<com.thoughtworks.qdox.model.JavaClass> implementz)  
      void setInterface​(boolean anInterface)  
      void setJavaPackage​(com.thoughtworks.qdox.model.JavaPackage javaPackage)
      Only used when constructing the model by hand / without source
      void setSuperClass​(com.thoughtworks.qdox.model.JavaType type)  
      void setTypeParameters​(java.util.List<ModifyableJavaTypeVariable<com.thoughtworks.qdox.model.JavaClass>> typeParameters)  
      java.lang.String toGenericString()  
      java.lang.String toString()  
      • Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractInheritableJavaEntity

        getTagByName
      • Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractJavaEntity

        getDeclaringClass, getModifiers, getName, isAbstract, isFinal, isNative, isPrivate, isProtected, isPublic, isStatic, isStrictfp, isSynchronized, isTransient, isVolatile, setDeclaringClass, setModifiers, setName
      • Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractBaseJavaEntity

        getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByName, setAnnotations, setComment, setSource, setTags
      • Methods inherited from class com.thoughtworks.qdox.model.impl.AbstractJavaModel

        getLineNumber, getModelWriter, setLineNumber, setModelWriterFactory
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface com.thoughtworks.qdox.model.JavaAnnotatedElement

        getAnnotations, getComment, getNamedParameter, getTagByName, getTags, getTagsByName
      • Methods inherited from interface com.thoughtworks.qdox.model.JavaClass

        getDeclaringClass, getModifiers, getName, isAbstract, isFinal, isPrivate, isProtected, isPublic, isStatic
      • Methods inherited from interface com.thoughtworks.qdox.model.JavaModel

        getLineNumber
    • Constructor Detail

      • ModifyableJavaClass

        protected ModifyableJavaClass()
      • ModifyableJavaClass

        public ModifyableJavaClass​(java.lang.String name)
      • ModifyableJavaClass

        public ModifyableJavaClass​(com.thoughtworks.qdox.model.JavaSource source)
    • Method Detail

      • isInterface

        public boolean isInterface()
        Specified by:
        isInterface in interface com.thoughtworks.qdox.model.JavaClass
      • isPrimitive

        public boolean isPrimitive()
        Specified by:
        isPrimitive in interface com.thoughtworks.qdox.model.JavaClass
      • isVoid

        public boolean isVoid()
        Specified by:
        isVoid in interface com.thoughtworks.qdox.model.JavaClass
      • isEnum

        public boolean isEnum()
        Specified by:
        isEnum in interface com.thoughtworks.qdox.model.JavaClass
      • isAnnotation

        public boolean isAnnotation()
        Specified by:
        isAnnotation in interface com.thoughtworks.qdox.model.JavaClass
      • isArray

        public boolean isArray()
        Specified by:
        isArray in interface com.thoughtworks.qdox.model.JavaClass
      • getComponentType

        public com.thoughtworks.qdox.model.JavaClass getComponentType()
        Specified by:
        getComponentType in interface com.thoughtworks.qdox.model.JavaClass
      • getDimensions

        public int getDimensions()
        Specified by:
        getDimensions in interface com.thoughtworks.qdox.model.JavaClass
      • getSuperClass

        public com.thoughtworks.qdox.model.JavaType getSuperClass()
        Specified by:
        getSuperClass in interface com.thoughtworks.qdox.model.JavaClass
      • getSuperJavaClass

        public com.thoughtworks.qdox.model.JavaClass getSuperJavaClass()
        Shorthand for getSuperClass().getJavaClass() with null checking.
        Specified by:
        getSuperJavaClass in interface com.thoughtworks.qdox.model.JavaClass
      • getImplements

        public java.util.List<com.thoughtworks.qdox.model.JavaType> getImplements()
        Specified by:
        getImplements in interface com.thoughtworks.qdox.model.JavaClass
      • getInterfaces

        public java.util.List<com.thoughtworks.qdox.model.JavaClass> getInterfaces()
        Specified by:
        getInterfaces in interface com.thoughtworks.qdox.model.JavaClass
      • getCodeBlock

        public java.lang.String getCodeBlock()
        Specified by:
        getCodeBlock in interface com.thoughtworks.qdox.model.JavaClass
        Specified by:
        getCodeBlock in interface com.thoughtworks.qdox.model.JavaModel
      • setInterface

        public void setInterface​(boolean anInterface)
      • setEnum

        public void setEnum​(boolean anEnum)
      • setAnnotation

        public void setAnnotation​(boolean anAnnotation)
      • addConstructor

        public void addConstructor​(com.thoughtworks.qdox.model.JavaConstructor constructor)
      • addMethod

        public void addMethod​(com.thoughtworks.qdox.model.JavaMethod meth)
      • setSuperClass

        public void setSuperClass​(com.thoughtworks.qdox.model.JavaType type)
      • setImplementz

        public void setImplementz​(java.util.List<com.thoughtworks.qdox.model.JavaClass> implementz)
      • getTypeParameters

        public java.util.List<ModifyableJavaTypeVariable<com.thoughtworks.qdox.model.JavaClass>> getTypeParameters()
        Specified by:
        getTypeParameters in interface com.thoughtworks.qdox.model.JavaGenericDeclaration
      • setTypeParameters

        public void setTypeParameters​(java.util.List<ModifyableJavaTypeVariable<com.thoughtworks.qdox.model.JavaClass>> typeParameters)
      • addField

        public void addField​(com.thoughtworks.qdox.model.JavaField javaField)
      • setJavaPackage

        public void setJavaPackage​(com.thoughtworks.qdox.model.JavaPackage javaPackage)
        Only used when constructing the model by hand / without source
        Parameters:
        javaPackage - JavaPackage for this class
      • getSource

        public com.thoughtworks.qdox.model.JavaSource getSource()
        Specified by:
        getSource in interface com.thoughtworks.qdox.model.JavaClass
        Overrides:
        getSource in class com.thoughtworks.qdox.model.impl.AbstractBaseJavaEntity
      • getPackage

        public com.thoughtworks.qdox.model.JavaPackage getPackage()
        Specified by:
        getPackage in interface com.thoughtworks.qdox.model.JavaClass
      • getPackageName

        public java.lang.String getPackageName()
        Specified by:
        getPackageName in interface com.thoughtworks.qdox.model.JavaClass
      • getFullyQualifiedName

        public java.lang.String getFullyQualifiedName()
        Specified by:
        getFullyQualifiedName in interface com.thoughtworks.qdox.model.JavaType
      • getGenericFullyQualifiedName

        public java.lang.String getGenericFullyQualifiedName()
        Specified by:
        getGenericFullyQualifiedName in interface com.thoughtworks.qdox.model.JavaType
      • getCanonicalName

        public java.lang.String getCanonicalName()
        Specified by:
        getCanonicalName in interface com.thoughtworks.qdox.model.JavaType
      • getGenericCanonicalName

        public java.lang.String getGenericCanonicalName()
        Specified by:
        getGenericCanonicalName in interface com.thoughtworks.qdox.model.JavaType
      • getValue

        public java.lang.String getValue()
        Specified by:
        getValue in interface com.thoughtworks.qdox.model.JavaType
      • getGenericValue

        public java.lang.String getGenericValue()
        Specified by:
        getGenericValue in interface com.thoughtworks.qdox.model.JavaType
      • isInner

        public boolean isInner()
        Specified by:
        isInner in interface com.thoughtworks.qdox.model.JavaClass
      • getInitializers

        public java.util.List<com.thoughtworks.qdox.model.JavaInitializer> getInitializers()
        Specified by:
        getInitializers in interface com.thoughtworks.qdox.model.JavaClass
      • getConstructors

        public java.util.List<com.thoughtworks.qdox.model.JavaConstructor> getConstructors()
        Specified by:
        getConstructors in interface com.thoughtworks.qdox.model.JavaClass
      • getConstructor

        public com.thoughtworks.qdox.model.JavaConstructor getConstructor​(java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes)
        Specified by:
        getConstructor in interface com.thoughtworks.qdox.model.JavaClass
      • getConstructor

        public com.thoughtworks.qdox.model.JavaConstructor getConstructor​(java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes,
                                                                          boolean varArgs)
        Specified by:
        getConstructor in interface com.thoughtworks.qdox.model.JavaClass
      • getMethods

        public java.util.List<com.thoughtworks.qdox.model.JavaMethod> getMethods()
        Specified by:
        getMethods in interface com.thoughtworks.qdox.model.JavaClass
      • getMethods

        public java.util.List<com.thoughtworks.qdox.model.JavaMethod> getMethods​(boolean superclasses)
        Specified by:
        getMethods in interface com.thoughtworks.qdox.model.JavaClass
      • getMethodBySignature

        public com.thoughtworks.qdox.model.JavaMethod getMethodBySignature​(java.lang.String name,
                                                                           java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes)
        Specified by:
        getMethodBySignature in interface com.thoughtworks.qdox.model.JavaClass
      • getMethod

        public com.thoughtworks.qdox.model.JavaMethod getMethod​(java.lang.String name,
                                                                java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes,
                                                                boolean varArgs)
        Specified by:
        getMethod in interface com.thoughtworks.qdox.model.JavaClass
      • getMethodBySignature

        public com.thoughtworks.qdox.model.JavaMethod getMethodBySignature​(java.lang.String name,
                                                                           java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes,
                                                                           boolean superclasses)
        Specified by:
        getMethodBySignature in interface com.thoughtworks.qdox.model.JavaClass
      • getMethodBySignature

        public com.thoughtworks.qdox.model.JavaMethod getMethodBySignature​(java.lang.String name,
                                                                           java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes,
                                                                           boolean superclasses,
                                                                           boolean varArg)
        Specified by:
        getMethodBySignature in interface com.thoughtworks.qdox.model.JavaClass
      • getMethodsBySignature

        public java.util.List<com.thoughtworks.qdox.model.JavaMethod> getMethodsBySignature​(java.lang.String name,
                                                                                            java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes,
                                                                                            boolean superclasses)
        Specified by:
        getMethodsBySignature in interface com.thoughtworks.qdox.model.JavaClass
      • getMethodsBySignature

        public java.util.List<com.thoughtworks.qdox.model.JavaMethod> getMethodsBySignature​(java.lang.String name,
                                                                                            java.util.List<com.thoughtworks.qdox.model.JavaType> parameterTypes,
                                                                                            boolean superclasses,
                                                                                            boolean varArg)
        Specified by:
        getMethodsBySignature in interface com.thoughtworks.qdox.model.JavaClass
      • getFields

        public java.util.List<com.thoughtworks.qdox.model.JavaField> getFields()
        Specified by:
        getFields in interface com.thoughtworks.qdox.model.JavaClass
      • getFieldByName

        public com.thoughtworks.qdox.model.JavaField getFieldByName​(java.lang.String name)
        Specified by:
        getFieldByName in interface com.thoughtworks.qdox.model.JavaClass
      • getEnumConstants

        public java.util.List<com.thoughtworks.qdox.model.JavaField> getEnumConstants()
        Specified by:
        getEnumConstants in interface com.thoughtworks.qdox.model.JavaClass
      • getEnumConstantByName

        public com.thoughtworks.qdox.model.JavaField getEnumConstantByName​(java.lang.String name)
        Specified by:
        getEnumConstantByName in interface com.thoughtworks.qdox.model.JavaClass
      • addInitializer

        public void addInitializer​(com.thoughtworks.qdox.model.JavaInitializer initializer)
      • addAllInitializer

        public void addAllInitializer​(java.util.List<com.thoughtworks.qdox.model.JavaInitializer> initializersList)
      • removeInitializer

        public void removeInitializer​(com.thoughtworks.qdox.model.JavaInitializer initializer)
      • addClass

        public void addClass​(com.thoughtworks.qdox.model.JavaClass cls)
      • getNestedClasses

        public java.util.List<com.thoughtworks.qdox.model.JavaClass> getNestedClasses()
        Specified by:
        getNestedClasses in interface com.thoughtworks.qdox.model.JavaClass
      • getNestedClassByName

        public com.thoughtworks.qdox.model.JavaClass getNestedClassByName​(java.lang.String name)
        Specified by:
        getNestedClassByName in interface com.thoughtworks.qdox.model.JavaClass
      • isA

        public boolean isA​(java.lang.String fullClassName)
        Specified by:
        isA in interface com.thoughtworks.qdox.model.JavaClass
      • isA

        public boolean isA​(com.thoughtworks.qdox.model.JavaClass javaClass)
        Specified by:
        isA in interface com.thoughtworks.qdox.model.JavaClass
      • getBeanProperties

        public java.util.List<com.thoughtworks.qdox.model.BeanProperty> getBeanProperties()
        Specified by:
        getBeanProperties in interface com.thoughtworks.qdox.model.JavaClass
      • getBeanProperties

        public java.util.List<com.thoughtworks.qdox.model.BeanProperty> getBeanProperties​(boolean superclasses)
        Specified by:
        getBeanProperties in interface com.thoughtworks.qdox.model.JavaClass
      • getBeanProperty

        public com.thoughtworks.qdox.model.BeanProperty getBeanProperty​(java.lang.String propertyName)
        Specified by:
        getBeanProperty in interface com.thoughtworks.qdox.model.JavaClass
      • getBeanProperty

        public com.thoughtworks.qdox.model.BeanProperty getBeanProperty​(java.lang.String propertyName,
                                                                        boolean superclasses)
        Specified by:
        getBeanProperty in interface com.thoughtworks.qdox.model.JavaClass
      • getDerivedClasses

        public java.util.List<com.thoughtworks.qdox.model.JavaClass> getDerivedClasses()
        Specified by:
        getDerivedClasses in interface com.thoughtworks.qdox.model.JavaClass
      • getTagsByName

        public java.util.List<com.thoughtworks.qdox.model.DocletTag> getTagsByName​(java.lang.String name,
                                                                                   boolean superclasses)
        Specified by:
        getTagsByName in interface com.thoughtworks.qdox.model.JavaClass
        Specified by:
        getTagsByName in class com.thoughtworks.qdox.model.impl.AbstractInheritableJavaEntity
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface com.thoughtworks.qdox.model.JavaClass
        Overrides:
        toString in class java.lang.Object
        See Also:
        Class.toString()
      • toGenericString

        public java.lang.String toGenericString()
        Specified by:
        toGenericString in interface com.thoughtworks.qdox.model.JavaType
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getJavaClassLibrary

        public com.thoughtworks.qdox.library.ClassLibrary getJavaClassLibrary()
        Specified by:
        getJavaClassLibrary in interface com.thoughtworks.qdox.model.JavaClass
      • replace

        public void replace​(com.thoughtworks.qdox.model.JavaField baseField,
                            com.thoughtworks.qdox.model.JavaField patchField)
        Replaces the given baseField with the given patchField. If the baseField does not exist, this method will do nothing
        Parameters:
        baseField - to be replaced
        patchField - to replace the baseField
      • replace

        public void replace​(com.thoughtworks.qdox.model.JavaMethod baseMethod,
                            com.thoughtworks.qdox.model.JavaMethod patchMethod)
        Replaces the given baseMethod with the given patchMethod. If the baseMethod does not exist, this method will do nothing
        Parameters:
        baseMethod - to be replaced
        patchMethod - to replace the baseMethod
      • replace

        public void replace​(com.thoughtworks.qdox.model.JavaConstructor baseConstructor,
                            com.thoughtworks.qdox.model.JavaConstructor patchConstructor)
        Replaces the given baseConstructor with the given patchConstructor. If the baseConstructor does not exist, this method will do nothing
        Parameters:
        baseConstructor - to be replaced
        patchConstructor - to replace the baseMethod
      • replace

        public void replace​(com.thoughtworks.qdox.model.JavaInitializer baseInitializerBlock,
                            com.thoughtworks.qdox.model.JavaInitializer patchInitializerBlock)
        Replaces the given baseInitializer with the given patchInitializer.
        Parameters:
        baseInitializerBlock -
        patchInitializerBlock -
      • getBinaryName

        public java.lang.String getBinaryName()
        Specified by:
        getBinaryName in interface com.thoughtworks.qdox.model.JavaType
      • getParentSource

        public com.thoughtworks.qdox.model.JavaSource getParentSource()
        Specified by:
        getParentSource in interface com.thoughtworks.qdox.model.JavaClass
      • getSimpleName

        public java.lang.String getSimpleName()
        Specified by:
        getSimpleName in interface com.thoughtworks.qdox.model.JavaClass