KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Other implementation For now explicit implements is needed (extends is not enough - bug in
12  * swapping)
13  *
14  * @author <a HREF="mailto:jboner@codehaus.org">Jonas BonŽr </a>
15  */

16 public class MyOtherImpl extends MyImpl implements Introductions, Cloneable JavaDoc {
17
18     public MyOtherImpl(Class JavaDoc targetClass) {
19         super(targetClass);
20     }
21
22     public void noArgs() throws RuntimeException JavaDoc {
23     }
24
25     public long longArg(long arg) {
26         return arg;
27     }
28
29     /**
30      * used by test case
31      */

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