Section A.2. Signature


A.2. Signature

A Signature interface is used to determine the signature of the code to which a join point is associated. The Signature interface provides access to the information available at any join point, whereas its subinterfaces in the next section provide more information depending on the join point type. (See Figure A-2Figure A-2.)

Figure A-3. The Signature interface


The Signature Interface


public String toString( )

Overrides the default toString( ) method on an object to return a string representation of the signature. An example of the string returned from the toString( ) method on a method call join point is:

void com.oreilly.aspectjcookbook.MyClass.foo(int, String)


public String toShortString( )

Provides an alternative to the toString( ) method that returns an abbreviated version of the string representation of the signature. An example of the string returned from the toShortString( ) method on a method call join point is:

MyClass.foo(..)


public String toLongString( )

Provides an alternative to the toString( ) method that returns an extended version of the string representation of the signature. An example of the string returned from the toLongString( ) method on a method call join point is:

public void com.oreilly.aspectjcookbook.MyClass.foo(int, java.lang.String)


public Class getDeclaringType( )

Returns the class that declared the member associated with the corresponding signature.


public String getDeclaringTypeName( )

Returns the fully qualified name of the member associated with the corresponding signature. An example of the string returned from the getdeclaringTypeName( ) method on a method call join point is:

com.oreilly.aspectjcookbook.MyClass


public int getModifiers( )

Returns the modifiers that are set on the corresponding signature.

Note that manipulating the int value that represents the modifiers using the java.lang.reflect.Modifier class.


public String getName( )

Just returns the identifier section of the signature. An example of the string returned from the getName( ) method on a method call join point is:

Foo



AspectJ Cookbook
Aspectj Cookbook
ISBN: 0596006543
EAN: 2147483647
Year: 2006
Pages: 203
Authors: Russ Miles

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net