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, 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
    • Constructor Detail

      • ModifyableJavaClass

        protected ModifyableJavaClass()
      • ModifyableJavaClass

        public ModifyableJavaClass​(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 List<com.thoughtworks.qdox.model.JavaType> getImplements()
        Specified by:
        getImplements in interface com.thoughtworks.qdox.model.JavaClass
      • getInterfaces

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

        public 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​(List<com.thoughtworks.qdox.model.JavaClass> implementz)
      • getTypeParameters

        public List<ModifyableJavaTypeVariable<com.thoughtworks.qdox.model.JavaClass>> getTypeParameters()
        Specified by:
        getTypeParameters in interface com.thoughtworks.qdox.model.JavaGenericDeclaration
      • 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 String getPackageName()
        Specified by:
        getPackageName in interface com.thoughtworks.qdox.model.JavaClass
      • getFullyQualifiedName

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

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

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

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

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

        public 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 List<com.thoughtworks.qdox.model.JavaInitializer> getInitializers()
        Specified by:
        getInitializers in interface com.thoughtworks.qdox.model.JavaClass
      • getConstructors

        public 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​(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​(List<com.thoughtworks.qdox.model.JavaType> parameterTypes,
                                                                          boolean varArgs)
        Specified by:
        getConstructor in interface com.thoughtworks.qdox.model.JavaClass
      • getMethods

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

        public 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​(String name,
                                                                           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​(String name,
                                                                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​(String name,
                                                                           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​(String name,
                                                                           List<com.thoughtworks.qdox.model.JavaType> parameterTypes,
                                                                           boolean superclasses,
                                                                           boolean varArg)
        Specified by:
        getMethodBySignature in interface com.thoughtworks.qdox.model.JavaClass
      • getMethodsBySignature

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

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

        public 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​(String name)
        Specified by:
        getFieldByName in interface com.thoughtworks.qdox.model.JavaClass
      • getEnumConstants

        public 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​(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​(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 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​(String name)
        Specified by:
        getNestedClassByName in interface com.thoughtworks.qdox.model.JavaClass
      • isA

        public boolean isA​(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 List<com.thoughtworks.qdox.model.BeanProperty> getBeanProperties()
        Specified by:
        getBeanProperties in interface com.thoughtworks.qdox.model.JavaClass
      • getBeanProperties

        public 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​(String propertyName)
        Specified by:
        getBeanProperty in interface com.thoughtworks.qdox.model.JavaClass
      • getBeanProperty

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

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

        public List<com.thoughtworks.qdox.model.DocletTag> getTagsByName​(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
      • toGenericString

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

        public int hashCode()
        Overrides:
        hashCode in class 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 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 String getSimpleName()
        Specified by:
        getSimpleName in interface com.thoughtworks.qdox.model.JavaClass