Interface CtClass<T>

    • Method Detail

      • getConstructors

        java.util.Set<CtConstructor<T>> getConstructors()
        Returns the constructors of this class. This includes the default constructor if this class has no constructors explicitly declared. Derived from CtType.getTypeMembers()
      • setAnonymousExecutables

        <C extends CtClass<T>> C setAnonymousExecutables​(java.util.List<CtAnonymousExecutable> e)
        Sets the anonymous blocks of this class.
      • addAnonymousExecutable

        <C extends CtClass<T>> C addAnonymousExecutable​(CtAnonymousExecutable e)
        Add an anonymous block to this class.
        e -
        true if this element changed as a result of the call
      • removeAnonymousExecutable

        boolean removeAnonymousExecutable​(CtAnonymousExecutable e)
        Remove an anonymous block to this class.
        e -
        true if this element changed as a result of the call
      • setConstructors

        <C extends CtClass<T>> C setConstructors​(java.util.Set<CtConstructor<T>> constructors)
        Sets the constructors for this class.
      • addConstructor

        <C extends CtClass<T>> C addConstructor​(CtConstructor<T> constructor)
        Adds a constructor to this class.
      • removeConstructor

        void removeConstructor​(CtConstructor<T> constructor)
        Removes a constructor from this class.
      • isAnonymous

        boolean isAnonymous()
        Return true if the referenced type is a anonymous type
        Specified by:
        isAnonymous in interface CtTypeInformation
      • newInstance

        T newInstance()
        Creates an instance of this class. Requirements: - the class must have a default constructor. - All dependencies (superclass, super-interfaces, imports) must be in the classpath, because the code is actually compiled (otherwise an exception is thrown) If the class has super-interfaces, the object can be cast to one of them. Otherwise, if the class has no super-interfaces, the methods can only be called with reflection. This instance is meant to be used for quick-testing, it uses a throwable classloader that will be garbage-collected with the instance.
      • setLabel

        <C extends CtStatement> C setLabel​(java.lang.String label)
        Description copied from interface: CtStatement
        Sets the label of this statement.
        Specified by:
        setLabel in interface CtStatement