Package javassist

Class CtMember.Cache

    • Method Detail

      • extendToString

        protected void extendToString​(java.lang.StringBuffer buffer)
        Description copied from class: CtMember
        Invoked by CtMember.toString() to add to the buffer and provide the complete value. Subclasses should invoke this method, adding a space before each token. The modifiers for the member are provided first; subclasses should provide additional data such as return type, field or method name, etc.
        Specified by:
        extendToString in class CtMember
      • hasAnnotation

        public boolean hasAnnotation​(java.lang.String clz)
        Description copied from class: CtMember
        Returns true if the class has the specified annotation type.
        Specified by:
        hasAnnotation in class CtMember
        Parameters:
        clz - the name of annotation type.
        Returns:
        true if the annotation is found, otherwise false.
      • getAnnotation

        public java.lang.Object getAnnotation​(java.lang.Class clz)
                                       throws java.lang.ClassNotFoundException
        Description copied from class: CtMember
        Returns the annotation if the class has the specified annotation type. For example, if an annotation @Author is associated with this member, an Author object is returned. The member values can be obtained by calling methods on the Author object.
        Specified by:
        getAnnotation in class CtMember
        Parameters:
        clz - the annotation type.
        Returns:
        the annotation if found, otherwise null.
        Throws:
        java.lang.ClassNotFoundException
      • getAnnotations

        public java.lang.Object[] getAnnotations()
                                          throws java.lang.ClassNotFoundException
        Description copied from class: CtMember
        Returns the annotations associated with this member. For example, if an annotation @Author is associated with this member, the returned array contains an Author object. The member values can be obtained by calling methods on the Author object.
        Specified by:
        getAnnotations in class CtMember
        Returns:
        an array of annotation-type objects.
        Throws:
        java.lang.ClassNotFoundException
        See Also:
        CtClass.getAnnotations()
      • getAttribute

        public byte[] getAttribute​(java.lang.String name)
        Description copied from class: CtMember
        Obtains a user-defined attribute with the given name. If that attribute is not found in the class file, this method returns null.

        Note that an attribute is a data block specified by the class file format. See AttributeInfo.

        Specified by:
        getAttribute in class CtMember
        Parameters:
        name - attribute name
      • getAvailableAnnotations

        public java.lang.Object[] getAvailableAnnotations()
        Description copied from class: CtMember
        Returns the annotations associated with this member. This method is equivalent to getAnnotations() except that, if any annotations are not on the classpath, they are not included in the returned array.
        Specified by:
        getAvailableAnnotations in class CtMember
        Returns:
        an array of annotation-type objects.
        See Also:
        CtMember.getAnnotations(), CtClass.getAvailableAnnotations()
      • getModifiers

        public int getModifiers()
        Description copied from class: CtMember
        Obtains the modifiers of the member.
        Specified by:
        getModifiers in class CtMember
        Returns:
        modifiers encoded with javassist.Modifier.
        See Also:
        Modifier
      • getName

        public java.lang.String getName()
        Description copied from class: CtMember
        Obtains the name of the member.

        As for constructor names, see getName() in CtConstructor.

        Specified by:
        getName in class CtMember
        See Also:
        CtConstructor.getName()
      • getSignature

        public java.lang.String getSignature()
        Description copied from class: CtMember
        Returns the character string representing the signature of the member. If two members have the same signature (parameter types etc.), getSignature() returns the same string.
        Specified by:
        getSignature in class CtMember
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 byte[] data)
        Description copied from class: CtMember
        Adds a user-defined attribute. The attribute is saved in the class file.

        Note that an attribute is a data block specified by the class file format. See AttributeInfo.

        Specified by:
        setAttribute in class CtMember
        Parameters:
        name - attribute name
        data - attribute value
      • setModifiers

        public void setModifiers​(int mod)
        Description copied from class: CtMember
        Sets the encoded modifiers of the member.
        Specified by:
        setModifiers in class CtMember
        See Also:
        Modifier
      • addMethod

        void addMethod​(CtMember method)
      • addConstructor

        void addConstructor​(CtMember cons)
      • addField

        void addField​(CtMember field)