1   /***************************************************************************************
2    * Copyright (c) Jonas BonŽr, Alexandre Vasseur. All rights reserved.                 *
3    * http://aspectwerkz.codehaus.org                                                    *
4    * ---------------------------------------------------------------------------------- *
5    * The software in this package is published under the terms of the LGPL license      *
6    * a copy of which has been included with this distribution in the license.txt file.  *
7    **************************************************************************************/
8   package test.mixin.perinstance;
9   
10  /***
11   * Here we use an expression:
12   *
13   * @Mixin(pointcut="within(test.mixin.perinstance.ToBeIntroduced) OR
14   *            hasfield(int test.mixin.perinstance.*.thisFieldNameShouldHopefullyBeUnique_perinstance) OR
15   *            hasmethod(void test.mixin.perinstance.*.thisMethodNameShouldHopefullyBeUnique_perinstance(..)) OR
16   *            within(test.mixin.perinstance.ToBeIntroducedParent)",
17   *            isTransient=true)
18   *
19   * @author <a href="mailto:jboner@codehaus.org">Jonas BonŽr </a>
20   */
21  public class MyImpl implements Introductions, Cloneable {
22  
23      public MyImpl(Object targetInstance) {
24      }
25  
26      public void NOT_IN_MIXIN_INTF() {
27      }
28  
29      //TODO: allow naming of mixin instead of innerClass FQN
30      public void noArgs() throws RuntimeException {
31      }
32  
33      public long longArg(long arg) {
34          return arg;
35      }
36  
37      public int intArg(int arg) {
38          return arg;
39      }
40  
41      public short shortArg(short arg) {
42          return arg;
43      }
44  
45      public double doubleArg(double arg) {
46          return arg;
47      }
48  
49      public float floatArg(float arg) {
50          return arg;
51      }
52  
53      public byte byteArg(byte arg) {
54          return arg;
55      }
56  
57      public boolean booleanArg(boolean arg) {
58          return arg;
59      }
60  
61      public char charArg(char arg) {
62          return arg;
63      }
64  
65      public Object objectArg(Object arg) {
66          return arg;
67      }
68  
69      public String[] arrayArg(String[] arg) {
70          return arg;
71      }
72  
73      public int variousArguments1(String str, int i, float f, Object o, long l) throws RuntimeException {
74          return str.hashCode() + i + (int) f + o.hashCode() + (int) l;
75      }
76  
77      public int variousArguments2(float f, int i, String str1, Object o, long l, String str2)
78              throws RuntimeException {
79          return (int) f + i + str1.hashCode() + o.hashCode() + (int) l + str2.hashCode();
80      }
81  
82      public void getVoid() throws RuntimeException {
83      }
84  
85      public long getLong() throws RuntimeException {
86          return 1L;
87      }
88  
89      public int getInt() throws RuntimeException {
90          return 1;
91      }
92  
93      public short getShort() throws RuntimeException {
94          return 1;
95      }
96  
97      public double getDouble() throws RuntimeException {
98          return 1.1D;
99      }
100 
101     public float getFloat() throws RuntimeException {
102         return 1.1F;
103     }
104 
105     public byte getByte() throws RuntimeException {
106         return Byte.parseByte("1");
107     }
108 
109     public char getChar() throws RuntimeException {
110         return 'A';
111     }
112 
113     public boolean getBoolean() throws RuntimeException {
114         return true;
115     }
116 
117     public void exceptionThrower() throws Throwable {
118         throw new UnsupportedOperationException("this is a test");
119     }
120 
121     public void exceptionThrowerChecked() throws CheckedException {
122         throw new CheckedException();
123     }
124 }
125