01: package samples;
02:
03: import net.sf.cglib.core.KeyFactory;
04:
05: public class KeySample {
06: private interface MyFactory {
07: public Object newInstance(int a, char[] b, String d);
08: }
09:
10: public static void main(String[] args) {
11: MyFactory f = (MyFactory) KeyFactory.create(MyFactory.class);
12: Object key1 = f.newInstance(20, new char[] { 'a', 'b' },
13: "hello");
14: Object key2 = f.newInstance(20, new char[] { 'a', 'b' },
15: "hello");
16: Object key3 = f.newInstance(20, new char[] { 'a', '_' },
17: "hello");
18: System.out.println(key1.equals(key2));
19: System.out.println(key2.equals(key3));
20: }
21: }
|