1  /*
     2   * Copyright the original author or authors.
     3   * 
     4   * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   * 
     8   *      http://www.mozilla.org/MPL/MPL-1.1.html
     9   * 
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  import org.as2lib.core.BasicInterface;
    18  import org.as2lib.aop.JoinPoint;
    19  
    20  /**
    21   * {@code Advice} reflects an advice in an Aspect-Oriented Programming Language like
    22   * AspectJ. This is the core interface that must be implemented to create a custom
    23   * advices.
    24   * 
    25   * <p>An advice defines the code to be executed at a specific pointcut, that defines
    26   * where and when this code shall be executed.
    27   * 
    28   * @author Simon Wacker
    29   * @see <a href="http://www.simonwacker.com/blog/archives/000066.php">Advice</a>
    30   */
    31  interface org.as2lib.aop.Advice extends BasicInterface {
    32  	
    33  	/**
    34  	 * Checks whether this advice captures the given {@code joinPoint}. This check is
    35  	 * normally being done using the set pointcut.
    36  	 * 
    37  	 * @param joinPoint the join point upon which to make the check
    38  	 * @return {@code true} if the given {@code joinPoint} is captured else {@code false}
    39  	 */
    40  	public function captures(joinPoint:JoinPoint):Boolean;
    41  	
    42  	/**
    43  	 * Returns a proxy method that can be used instead of the original method of the
    44  	 * {@code joinPoint}. This proxy does not only invoke the original method, but also
    45  	 * performs the weaved-in actions of the advice.
    46  	 *
    47  	 * @param joinPoint the join point that represents the original method
    48  	 * @return the proxy method
    49  	 */
    50  	public function getProxy(joinPoint:JoinPoint):Function;
    51  	
    52  }