Date: 02/14/06 (Code WTF) Keywords: no keywords public void setSelection(final Map ss) { super.setSelection(ss); this.selection = (Map) Proxy.newProxyInstance(ss.getClass().getClassLoader(), ss.getClass() .getInterfaces(), new InvocationHandler() { private static final String MEHTOD_PUT = "put"; private CustomBooleanEditor cbe = new CustomBooleanEditor(true); public Object invoke(Object proxy, Method m, Object[] args) throws Throwable { if (m.equals(Map.class.getMethod(MEHTOD_PUT, new Class[] { Object.class, Object.class }))) { if (args[1] instanceof String) { cbe.setAsText((String) args[1]); args[1] = cbe.getValue(); } else if (args[1] instanceof String[]) { cbe.setAsText(((String[]) args[1])[0]); args[1] = cbe.getValue(); } } return m.invoke(ss, args); } }); } Source: http://community.livejournal.com/code_wtf/28004.html
|