/* ******************************************************************* * Copyright (c) 1999-2001 Xerox Corporation, * 2002 Palo Alto Research Center, Incorporated (PARC). * All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 * which accompanies this distribution and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Xerox/PARC initial implementation * ******************************************************************/ package org.aspectj.lang; import org.aspectj.lang.reflect.SourceLocation; /** *
Provides reflective access to both the state available at a join point and
* static information about it. This information is available from the body
* of advice using the special form thisJoinPoint
. The primary
* use of this reflective information is for tracing and logging applications.
*
* aspect Logging { * before(): within(com.bigboxco..*) && execution(public * *(..)) { * System.err.println("entering: " + thisJoinPoint); * System.err.println(" w/args: " + thisJoinPoint.getArgs()); * System.err.println(" at: " + thisJoinPoint.getSourceLocation()); * } * } **/ public interface JoinPoint { String toString(); /** * Returns an abbreviated string representation of the join point. */ String toShortString(); /** * Returns an extended string representation of the join point. */ String toLongString(); /** *
Returns the currently executing object. This will always be
* the same object as that matched by the this
pointcut
* designator. Unless you specifically need this reflective access,
* you should use the this
pointcut designator to
* get at this object for better static typing and performance.
Returns null when there is no currently executing object available. * This includes all join points that occur in a static context.
*/ Object getThis(); /** * Returns the target object. This will always be
* the same object as that matched by the target
pointcut
* designator. Unless you specifically need this reflective access,
* you should use the target
pointcut designator to
* get at this object for better static typing and performance.
Returns null when there is no target object.
*/ Object getTarget(); /** *Returns the arguments at this join point.
*/ Object[] getArgs(); /** Returns the signature at the join point. * *getStaticPart().getSignature()
returns the same object
*/
Signature getSignature();
/** Returns the source location corresponding to the join point.
* *If there is no source location available, returns null.
* *Returns the SourceLocation of the defining class for default constructors.
* * getStaticPart().getSourceLocation()
returns the same object.
getStaticPart().getKind()
returns
* the same object.
*/
String getKind();
/**
* This helper object contains only the static information about a join point.
* It is available from the JoinPoint.getStaticPart()
method, and
* can be accessed separately within advice using the special form
* thisJoinPointStaticPart
.
If you are only interested in the static information about a join point, * you should access it through this type for the best performance. This * is particularly useful for library methods that want to do serious * manipulations of this information, i.e.
* ** public class LoggingUtils { * public static void prettyPrint(JoinPoint.StaticPart jp) { * ... * } * } * * aspect Logging { * before(): ... { LoggingUtils.prettyPrint(thisJoinPointStaticPart); } * } ** * @see JoinPoint#getStaticPart() */ public interface StaticPart { /** Returns the signature at the join point. */ Signature getSignature(); /**
Returns the source location corresponding to the join point.
* *If there is no source location available, returns null.
* *Returns the SourceLocation of the defining class for default constructors.
*/ SourceLocation getSourceLocation(); /**Returns a String representing the kind of join point. This String * is guaranteed to be interned
*/ String getKind(); /** * Return the id for this JoinPoint.StaticPart. All JoinPoint.StaticPart * instances are assigned an id number upon creation. For each advised type * the id numbers start at 0. *