Commit 272f7198 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

README.md

0 → 100644
+15 −0
Changes for README.md: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Example files for the title:  
  
# AspectJ Cookbook, by Russ Miles
  
[![AspectJ Cookbook, by Russ Miles](http://akamaicovers.oreilly.com/images/9780596006549/cat.gif)](https://www.safaribooksonline.com/library/view/title/0596006543//)
  
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
  
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
  
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
  
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
  
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.
+19 −0
Changes for aspectjcookbook_examples/appendices/appendix_I/com/oreilly/aspectjcookbook/JoinPointStringRepresentation.java: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
package com.oreilly.aspectjcookbook;

public aspect JoinPointStringRepresentation 
{
   pointcut callPointCut() : call(void MyClass.foo(int, String));

   before() : callPointCut()
   {
      System.out.println(thisJoinPoint.toString());
      System.out.println(thisJoinPoint.toShortString());
      System.out.println(thisJoinPoint.toLongString());
      System.out.println("");
      System.out.println(thisJoinPoint.getSignature().toString());
      System.out.println(thisJoinPoint.getSignature().toShortString());
      System.out.println(thisJoinPoint.getSignature().toLongString());
      System.out.println(thisJoinPoint.getSignature().getDeclaringTypeName());
      System.out.println(thisJoinPoint.getSignature().getName());
   }
}
+17 −0
Changes for aspectjcookbook_examples/appendices/appendix_I/com/oreilly/aspectjcookbook/MyClass.java: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
package com.oreilly.aspectjcookbook;

public class MyClass
{
	public void foo(int number, String name)
	{
		System.out.println("Inside foo (int, String)");
	}

	public static void main(String[] args)
	{
		// Create an instance of MyClass
		MyClass myObject = new MyClass();
		// Make the call to foo
		myObject.foo(1, "Russ Miles");
	}
}
 No newline at end of file
+8 −0
Changes for aspectjcookbook_examples/chapter_10/Within a control flow - exclude initial/AnotherClass.java: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line

public class AnotherClass
{
   public void bar(int number)
   {
      System.out.println("Inside AnotherClass.void bar(int)");
   }
}
+51 −0
Changes for aspectjcookbook_examples/chapter_10/Within a control flow - exclude initial/CFlowBelowRecipe.aj: 51 added lines, 0 removed lines.
Original line number Diff line number Diff line
/**
 * <p>Title: CFlowBelowRecipe aspect for Recipe 7.2</p>
 * <p>Description: Simple aspect for demonstrating the cflowbelow(pointcut) pointcut</p>
 * <p>Copyright: Copyright (c) 2003 Russell Miles</p>
 * @author Russell Miles
 * @version 1.0
 */

public aspect CFlowBelowRecipe 
{
   /*
   Specifies calling advice whenever a method
   matching the following rules gets called:
   
   Class Name: MyClass
   Method Name: foo
   Method Return Type: * (any return type)
   Method Parameters: an int followed by a String
   */
   pointcut callInitialPointcut() : call(
      void MyClass.foo(int, String));

   /*
   	Specifies calling advice whenever a join point is encountered
   	including and after the join point that triggers the pointcut
   	that is specified in the parameter:
   
   	Pointcut Name: callInitialPointcut
   */
   pointcut cflowPointcut() : cflowbelow(callInitialPointcut());

   // Advice declaration
   // This advice will be executed before the pointcut that picks it
   before() : cflowPointcut() && !within(CFlowBelowRecipe +)
   {
      System.out.println(
         "------------------- Aspect Advice Logic --------------------");
      System.out.println(
         "In the advice attached to the cflowbelowPointcut point cut");
      System.out.println(
         "Join Point Kind: " + thisJoinPoint.getKind());
      System.out.println(
         "Signature: "
            + thisJoinPoint.getStaticPart().getSignature());
      System.out.println(
         "Source Line: "
            + thisJoinPoint.getStaticPart().getSourceLocation());
      System.out.println(
         "------------------------------------------------------------");
   }
}
Loading