Interface Signature

  • All Known Subinterfaces:
    AdviceSignature, CatchClauseSignature, CodeSignature, ConstructorSignature, FieldSignature, InitializerSignature, LockSignature, MemberSignature, MethodSignature, UnlockSignature
    All Known Implementing Classes:
    FieldSignatureImpl

    public interface Signature

    Represents the signature at a join point. This interface parallels java.lang.reflect.Member.

    This interface is typically used for tracing or logging applications to obtain reflective information about the join point, i.e. using the j2se 1.4 java.util.logging API

     aspect Logging {
         Logger logger = Logger.getLogger("MethodEntries");
     
         before(): within(com.bigboxco..*) && execution(public * *(..)) {
             Signature sig = thisJoinPoint.getSignature();
             logger.entering(sig.getDeclaringType().getName(),
                             sig.getName());
         }
     }
     

    More detailed information about a specific kind of signature can be obtained by casting this Signature object into one of its more specific sub-types available in org.aspectj.lang.reflect.

    See Also:
    Member, Logger
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Class getDeclaringType()
      Returns a java.lang.Class object representing the class, interface, or aspect that declared this member.
      java.lang.String getDeclaringTypeName()
      Returns the fully-qualified name of the declaring type.
      int getModifiers()
      Returns the modifiers on this signature represented as an int.
      java.lang.String getName()
      Returns the identifier part of this signature.
      java.lang.String toLongString()
      Returns an extended string representation of this signature.
      java.lang.String toShortString()
      Returns an abbreviated string representation of this signature.
      java.lang.String toString()  
    • Method Detail

      • toString

        java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toShortString

        java.lang.String toShortString()
        Returns an abbreviated string representation of this signature.
      • toLongString

        java.lang.String toLongString()
        Returns an extended string representation of this signature.
      • getName

        java.lang.String getName()
        Returns the identifier part of this signature. For methods this will return the method name.
        See Also:
        Member.getName()
      • getModifiers

        int getModifiers()
        Returns the modifiers on this signature represented as an int. Use the constants and helper methods defined on java.lang.reflect.Modifier to manipulate this, i.e.
             // check if this signature is public
             java.lang.reflect.Modifier.isPublic(sig.getModifiers());
         
             // print out the modifiers
             java.lang.reflect.Modifier.toString(sig.getModifiers());
         
        See Also:
        Member.getModifiers(), Modifier
      • getDeclaringType

        java.lang.Class getDeclaringType()

        Returns a java.lang.Class object representing the class, interface, or aspect that declared this member. For intra-member declarations, this will be the type on which the member is declared, not the type where the declaration is lexically written. Use SourceLocation.getWithinType() to get the type in which the declaration occurs lexically.

        For consistency with java.lang.reflect.Member, this method should have been named getDeclaringClass().

        See Also:
        Member.getDeclaringClass()
      • getDeclaringTypeName

        java.lang.String getDeclaringTypeName()
        Returns the fully-qualified name of the declaring type. This is equivalent to calling getDeclaringType().getName(), but caches the result for greater efficiency.