config: implement toString/equals/hashCode for Config proxies
This commit is contained in:
@@ -63,6 +63,21 @@ class ConfigInvocationHandler implements InvocationHandler
|
|||||||
|
|
||||||
Class<?> iface = proxy.getClass().getInterfaces()[0];
|
Class<?> iface = proxy.getClass().getInterfaces()[0];
|
||||||
|
|
||||||
|
if ("toString".equals(method.getName()) && args == null)
|
||||||
|
{
|
||||||
|
return iface.getSimpleName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("hashCode".equals(method.getName()) && args == null)
|
||||||
|
{
|
||||||
|
return System.identityHashCode(proxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("equals".equals(method.getName()) && args != null && args.length == 1)
|
||||||
|
{
|
||||||
|
return proxy == args[0];
|
||||||
|
}
|
||||||
|
|
||||||
ConfigGroup group = iface.getAnnotation(ConfigGroup.class);
|
ConfigGroup group = iface.getAnnotation(ConfigGroup.class);
|
||||||
ConfigItem item = method.getAnnotation(ConfigItem.class);
|
ConfigItem item = method.getAnnotation(ConfigItem.class);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user