KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > lang > Signature


1 /* *******************************************************************
2  * Copyright (c) 1999-2001 Xerox Corporation,
3  * 2002 Palo Alto Research Center, Incorporated (PARC).
4  * All rights reserved.
5  * This program and the accompanying materials are made available
6  * under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * Xerox/PARC initial implementation
12  * ******************************************************************/

13
14
15 package org.aspectj.lang;
16
17 /** <p>Represents the signature at a join point. This interface parallels
18  * <code>java.lang.reflect.Member</code>. </p>
19  *
20  * <p>This interface is typically used for tracing or logging applications
21  * to obtain reflective information about the join point, i.e. using
22  * the j2se 1.4 <code>java.util.logging</code> API</p>
23  * <pre>
24  * aspect Logging {
25  * Logger logger = Logger.getLogger("MethodEntries");
26  *
27  * before(): within(com.bigboxco..*) && execution(public * *(..)) {
28  * Signature sig = thisJoinPoint.getSignature();
29  * logger.entering(sig.getDeclaringType().getName(),
30  * sig.getName());
31  * }
32  * }
33  * </pre>
34  *
35  *
36  * <p>More detailed information about a specific kind of signature can
37  * be obtained by casting this <code>Signature</code> object into one
38  * of its more specific sub-types available in
39  * <code>org.aspectj.lang.reflect</code>.
40  *
41  * @see java.lang.reflect.Member
42  * @see java.util.logging.Logger
43  */

44 public interface Signature {
45     String JavaDoc toString();
46     /**
47      * Returns an abbreviated string representation of this signature.
48      */

49     String JavaDoc toShortString();
50
51     /**
52      * Returns an extended string representation of this signature.
53      */

54     String JavaDoc toLongString();
55
56
57     /**
58      * Returns the identifier part of this signature. For methods this
59      * will return the method name.
60      *
61      * @see java.lang.reflect.Member#getName
62      */

63     String JavaDoc getName();
64
65     /**
66      * Returns the modifiers on this signature represented as an int. Use
67      * the constants and helper methods defined on
68      * <code>java.lang.reflect.Modifier</code> to manipulate this, i.e.
69      * <pre>
70      * // check if this signature is public
71      * java.lang.reflect.Modifier.isPublic(sig.getModifiers());
72      *
73      * // print out the modifiers
74      * java.lang.reflect.Modifier.toString(sig.getModifiers());
75      * </pre>
76      *
77      * @see java.lang.reflect.Member#getModifiers
78      * @see java.lang.reflect.Modifier
79      */

80     int getModifiers();
81
82     /**
83      * <p>Returns a <code>java.lang.Class</code> object representing the class,
84      * interface, or aspect that declared this member. For intra-member
85      * declarations, this will be the type on which the member is declared,
86      * not the type where the declaration is lexically written. Use
87      * <code>SourceLocation.getWithinType()</code> to get the type in
88      * which the declaration occurs lexically.</p>
89      * <p>For consistency with <code>java.lang.reflect.Member</code>, this
90      * method should have been named <code>getDeclaringClass()</code>.</p>
91      *
92      * @see java.lang.reflect.Member#getDeclaringClass
93      */

94     Class JavaDoc getDeclaringType();
95     
96     /**
97      * Returns the fully-qualified name of the declaring type. This is
98      * equivalent to calling getDeclaringType().getName(), but caches
99      * the result for greater efficiency.
100      */

101     String JavaDoc getDeclaringTypeName();
102 }
103
Popular Tags