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.env.reflect.TypeMemberInfo;
    19  
    20  /**
    21   * {@code JoinPoint} represents an identifiable point in a program. Although this
    22   * points could by theory also be try..catch blocks, the join points offered by this
    23   * framework are limited to members of classes or interfaces, these are methods and
    24   * properties.
    25   * 
    26   * @author Simon Wacker
    27   * @see <a href="http://www.simonwacker.com/blog/archives/000041.php">Terms and AspectJ</a>
    28   */
    29  interface org.as2lib.aop.JoinPoint extends BasicInterface {
    30  	
    31  	/**
    32  	 * Returns the info of the represented type member; this information is also known
    33  	 * as the join point's static part. Note that the type of this join point is also
    34  	 * part of this join point's static part.
    35  	 * 
    36  	 * @return the info representing the static part of this join point
    37  	 */
    38  	public function getInfo(Void):TypeMemberInfo;
    39  	
    40  	/**
    41  	 * Executes the type member represented by this join point passing the given
    42  	 * {@code args} and returns the result.
    43  	 *
    44  	 * @param args the arguments to use for the execution
    45  	 * @return the result of the type member execution
    46  	 */
    47  	public function proceed(args:Array);
    48  	
    49  	/**
    50  	 * Returns the logical this of the interception. This means if this join point is
    51  	 * part of a call-pointcut the result will refer to the object where the call was
    52  	 * made from. If this join point is part of an execution-, set- or get-pointcut the
    53  	 * result will refer to the object that represented method or property resides in.
    54  	 * 
    55  	 * @return the logical this of this join point depending on the used pointcut
    56  	 * @see <a href="http://www.simonwacker.com/blog/archives/000068.php">Passing Context</a>
    57  	 */
    58  	public function getThis(Void);
    59  	
    60  	/**
    61  	 * Returns the type of the join point.
    62  	 * 
    63  	 * <p>Supported types are declared as constants in the {@link AbstractJoinPoint}
    64  	 * class.
    65  	 *
    66  	 * @return the type of this join point
    67  	 */
    68  	public function getType(Void):Number;
    69  	
    70  	/**
    71  	 * Checks if this join point matches the given {@code pattern}. Depending on the
    72  	 * used matcher the pattern may contain wildcards like {@code "*"} and {@code ".."}.
    73  	 * A pattern could for example be {@code "org..BasicClass.*"}.
    74  	 * 
    75  	 * @param pattern the pattern to match against this join point
    76  	 * @return {@code true} if the given {@code pattern} matches this join point else
    77  	 * {@code false}
    78  	 * @see WildcardMatcher
    79  	 * @see <a href="http://www.simonwacker.com/blog/archives/000053">Wildcards</a>
    80  	 */
    81  	public function matches(pattern:String):Boolean;
    82  	
    83  	/**
    84  	 * Returns a copy of this join point with an updated logical this. This join point
    85  	 * is left unchanged.
    86  	 * 
    87  	 * @param thiz the new logical this
    88  	 * @return a copy of this join point with an updated logical this
    89  	 * @see #getThis
    90  	 */
    91  	public function update(thiz):JoinPoint;
    92  	
    93  	/**
    94  	 * Returns a copy of this join point that reflects its current state.
    95  	 * 
    96  	 * <p>It is common practice to create a new join point for a not-fixed method info.
    97  	 * This is when the underlying concrete method this join point reflects may change.
    98  	 * To make the concrete method and other parts that may change fixed you can use
    99  	 * this method to get a new fixed join point, a snapshot.
   100  	 * 
   101  	 * @return a snapshot of this join point
   102  	 */
   103  	public function snapshot(Void):JoinPoint;
   104  	
   105  }