| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.component.wiki.internal; |
| 21 |
|
|
| 22 |
|
import java.lang.reflect.Method; |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
@link |
| 26 |
|
|
| 27 |
|
@version |
| 28 |
|
@since |
| 29 |
|
|
| |
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 10 |
Complexity Density: 0.83 |
|
| 30 |
|
public final class ObjectMethodsProxy |
| 31 |
|
{ |
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 35 |
0 |
private ObjectMethodsProxy()... |
| 36 |
|
{ |
| 37 |
|
|
| 38 |
|
} |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
@link |
| 42 |
|
|
| 43 |
|
@param |
| 44 |
|
@param |
| 45 |
|
@param |
| 46 |
|
@return |
| 47 |
|
|
| |
|
| 0% |
Uncovered Elements: 15 (15) |
Complexity: 5 |
Complexity Density: 0.56 |
|
| 48 |
0 |
public static Object invoke(Object proxy, Method method, Object[] args)... |
| 49 |
|
{ |
| 50 |
0 |
try { |
| 51 |
0 |
if (method.equals(Object.class.getMethod("hashCode"))) { |
| 52 |
0 |
return proxyHashCode(proxy); |
| 53 |
0 |
} else if (method.equals(Object.class.getMethod("equals", new Class[] {Object.class}))) { |
| 54 |
0 |
return proxyEquals(proxy, args[0]); |
| 55 |
0 |
} else if (method.equals(Object.class.getMethod("toString"))) { |
| 56 |
0 |
return proxyToString(proxy); |
| 57 |
|
} else { |
| 58 |
0 |
throw new InternalError("unexpected Object method dispatched: " + method); |
| 59 |
|
} |
| 60 |
|
} catch (NoSuchMethodException e) { |
| 61 |
0 |
throw new NoSuchMethodError(e.getMessage()); |
| 62 |
|
} |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
@link |
| 67 |
|
|
| 68 |
|
@param |
| 69 |
|
@return@link |
| 70 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 71 |
0 |
private static Integer proxyHashCode(Object proxy)... |
| 72 |
|
{ |
| 73 |
0 |
return System.identityHashCode(proxy); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
|
| 77 |
|
@link |
| 78 |
|
|
| 79 |
|
@param |
| 80 |
|
@param |
| 81 |
|
@return |
| 82 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 83 |
0 |
private static Boolean proxyEquals(Object proxy, Object other)... |
| 84 |
|
{ |
| 85 |
0 |
return (proxy == other ? Boolean.TRUE : Boolean.FALSE); |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
|
| 89 |
|
@link |
| 90 |
|
|
| 91 |
|
@param |
| 92 |
|
@return |
| 93 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 94 |
0 |
private static String proxyToString(Object proxy)... |
| 95 |
|
{ |
| 96 |
0 |
return proxy.getClass().getName() + '@' + Integer.toHexString(proxy.hashCode()); |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
|
| 100 |
|
} |