KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > mixin > perclass > MyImplReplacement


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.perclass;
9
10 /**
11  * Replacement for MyImpl mixin
12  *
13  * @author <a HREF="mailto:alex@gnilux.com">Alexandre Vasseur </a>
14  */

15 public class MyImplReplacement implements Cloneable JavaDoc, Introductions {
16     public MyImplReplacement(Class JavaDoc target) {
17     }
18
19     public void noArgs() throws RuntimeException JavaDoc {
20     }
21
22     public long longArg(long arg) {
23         return arg;
24     }
25
26     /**
27      * Used in test suite: replacement does a -2 x
28      */

29     public int intArg(int arg) {
30         return -2 * arg;
31     }
32
33     public short shortArg(short arg) {
34         return arg;
35     }
36
37     public double doubleArg(double arg) {
38         return arg;
39     }
40
41     public float floatArg(float arg) {
42         return arg;
43     }
44
45     public byte byteArg(byte arg) {
46         return arg;
47     }
48
49     public boolean booleanArg(boolean arg) {
50         return arg;
51     }
52
53     public char charArg(char arg) {
54         return arg;
55     }
56
57     public Object JavaDoc objectArg(Object JavaDoc arg) {
58         return arg;
59     }
60
61     public String JavaDoc[] arrayArg(String JavaDoc[] arg) {
62         return arg;
63     }
64
65     public int variousArguments1(String JavaDoc str, int i, float f, Object JavaDoc o, long l) throws RuntimeException JavaDoc {
66         return str.hashCode() + i + (int) f + o.hashCode() + (int) l;
67     }
68
69     public int variousArguments2(float f, int i, String JavaDoc str1, Object JavaDoc o, long l, String JavaDoc str2) throws RuntimeException JavaDoc {
70         return (int) f + i + str1.hashCode() + o.hashCode() + (int) l + str2.hashCode();
71     }
72
73     public void getVoid() throws RuntimeException JavaDoc {
74     }
75
76     public long getLong() throws RuntimeException JavaDoc {
77         return 1L;
78     }
79
80     public int getInt() throws RuntimeException JavaDoc {
81         return 1;
82     }
83
84     public short getShort() throws RuntimeException JavaDoc {
85         return 1;
86     }
87
88     public double getDouble() throws RuntimeException JavaDoc {
89         return 1.1D;
90     }
91
92     public float getFloat() throws RuntimeException JavaDoc {
93         return 1.1F;
94     }
95
96     public byte getByte() throws RuntimeException JavaDoc {
97         return Byte.parseByte("1");
98     }
99
100     public char getChar() throws RuntimeException JavaDoc {
101         return 'A';
102     }
103
104     public boolean getBoolean() throws RuntimeException JavaDoc {
105         return true;
106     }
107
108     public void exceptionThrower() throws Throwable JavaDoc {
109         throw new UnsupportedOperationException JavaDoc("this is a test");
110     }
111
112     public void exceptionThrowerChecked() throws CheckedException {
113         throw new CheckedException();
114     }
115 }
Popular Tags