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 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, FieldInterceptor {
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 *   Object get(FieldAccess fa) throws Throwable {
049 *     debug(fa.getField(), fa.getThis(), null);
050 *     return fa.proceed();
051 *   }
052 *
053 *   Object set(FieldAccess fa) throws Throwable {
054 *     debug(fa.getField(), fa.getThis(), fa.getValueToSet());
055 *     return fa.proceed();
056 *   }
057 *
058 *   void debug(AccessibleObject ao, Object this, Object value) {
059 *     ...
060 *   }
061 * }
062 * </pre>
063 *
064 * @author Rod Johnson
065 * @see Joinpoint
066 */
067public interface Interceptor extends Advice {
068
069}