111 |
* the only way to create an instance of the proxy class.</li> |
* the only way to create an instance of the proxy class.</li> |
112 |
* <li>The proxy class contains a single constructor, which takes as |
* <li>The proxy class contains a single constructor, which takes as |
113 |
* its only argument an {@link InvocationHandler}. The method |
* its only argument an {@link InvocationHandler}. The method |
114 |
* {@link #newInstance} is shorthand to do the necessary |
* {@link #newProxyInstance(ClassLoader, Class[], InvocationHandler)} |
115 |
* reflection.</li> |
* is shorthand to do the necessary reflection.</li> |
116 |
* </ul> |
* </ul> |
117 |
* |
* |
118 |
* <h3>Proxy Instances</h3> |
* <h3>Proxy Instances</h3> |
413 |
*/ |
*/ |
414 |
ProxyType(ClassLoader loader, Class[] interfaces) |
ProxyType(ClassLoader loader, Class[] interfaces) |
415 |
{ |
{ |
|
if (loader == null) |
|
|
loader = ClassLoader.getSystemClassLoader(); |
|
416 |
this.loader = loader; |
this.loader = loader; |
417 |
this.interfaces = interfaces; |
this.interfaces = interfaces; |
418 |
} |
} |
424 |
*/ |
*/ |
425 |
public int hashCode() |
public int hashCode() |
426 |
{ |
{ |
427 |
//loader is always not null |
int hash = loader == null ? 0 : loader.hashCode(); |
|
int hash = loader.hashCode(); |
|
428 |
for (int i = 0; i < interfaces.length; i++) |
for (int i = 0; i < interfaces.length; i++) |
429 |
hash = hash * 31 + interfaces[i].hashCode(); |
hash = hash * 31 + interfaces[i].hashCode(); |
430 |
return hash; |
return hash; |