001/*
002 * Copyright 2002-2019 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 org.aopalliance.aop.Advice;
020
021/**
022 * This interface represents a generic interceptor.
023 *
024 * <p>A generic interceptor can intercept runtime events that occur
025 * within a base program. Those events are materialized by (reified
026 * in) joinpoints. Runtime joinpoints can be invocations, field
027 * access, exceptions...
028 *
029 * <p>This interface is not used directly. Use the sub-interfaces
030 * to intercept specific events. For instance, the following class
031 * implements some specific interceptors in order to implement a
032 * debugger:
033 *
034 * <pre class=code>
035 * class DebuggingInterceptor implements MethodInterceptor,
036 *     ConstructorInterceptor {
037 *
038 *   Object invoke(MethodInvocation i) throws Throwable {
039 *     debug(i.getMethod(), i.getThis(), i.getArgs());
040 *     return i.proceed();
041 *   }
042 *
043 *   Object construct(ConstructorInvocation i) throws Throwable {
044 *     debug(i.getConstructor(), i.getThis(), i.getArgs());
045 *     return i.proceed();
046 *   }
047 *
048 *   void debug(AccessibleObject ao, Object this, Object value) {
049 *     ...
050 *   }
051 * }
052 * </pre>
053 *
054 * @author Rod Johnson
055 * @see Joinpoint
056 */
057public interface Interceptor extends Advice {
058
059}