001/*
002 * Copyright 2002-2016 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.aopalliance.intercept;
018
019import java.lang.reflect.AccessibleObject;
020
021/**
022 * This interface represents a generic runtime joinpoint (in the AOP
023 * terminology).
024 *
025 * <p>A runtime joinpoint is an <i>event</i> that occurs on a static
026 * joinpoint (i.e. a location in a the program). For instance, an
027 * invocation is the runtime joinpoint on a method (static joinpoint).
028 * The static part of a given joinpoint can be generically retrieved
029 * using the {@link #getStaticPart()} method.
030 *
031 * <p>In the context of an interception framework, a runtime joinpoint
032 * is then the reification of an access to an accessible object (a
033 * method, a constructor, a field), i.e. the static part of the
034 * joinpoint. It is passed to the interceptors that are installed on
035 * the static joinpoint.
036 *
037 * @author Rod Johnson
038 * @see Interceptor
039 */
040public interface Joinpoint {
041
042        /**
043         * Proceed to the next interceptor in the chain.
044         * <p>The implementation and the semantics of this method depends
045         * on the actual joinpoint type (see the children interfaces).
046         * @return see the children interfaces' proceed definition
047         * @throws Throwable if the joinpoint throws an exception
048         */
049        Object proceed() throws Throwable;
050
051        /**
052         * Return the object that holds the current joinpoint's static part.
053         * <p>For instance, the target object for an invocation.
054         * @return the object (can be null if the accessible object is static)
055         */
056        Object getThis();
057
058        /**
059         * Return the static part of this joinpoint.
060         * <p>The static part is an accessible object on which a chain of
061         * interceptors are installed.
062         */
063        AccessibleObject getStaticPart();
064
065}