public Object getProperty(String property) { if (fields.containsKey(property)) { return fields.get(property); } else { BindPathSnooper snooper = new BindPathSnooper(); fields.put(property, snooper); return snooper; } }
public Closure run() { // assume closures have only 1 constructor, of the form (Object, Reference*) Constructor constructor = closureClass.getConstructors()[0]; int paramCount = constructor.getParameterTypes().length; Object[] args = new Object[paramCount]; args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper()); } try { boolean acc = constructor.isAccessible(); constructor.setAccessible(true); Closure localCopy = (Closure) constructor.newInstance(args); if (!acc) { constructor.setAccessible(false); } localCopy.setResolveStrategy(Closure.DELEGATE_ONLY); for (Field f:closureClass.getDeclaredFields()) { acc = f.isAccessible(); f.setAccessible(true); if (f.getType() == Reference.class) { delegate.fields.put(f.getName(), (BindPathSnooper) ((Reference) f.get(localCopy)).get()); } if (!acc) { f.setAccessible(false); } } return localCopy; } catch (Exception e) { throw new RuntimeException("Error snooping closure", e); } } });
throw new RuntimeException("Source binding must the Trigger Binding as well"); final BindPathSnooper delegate = new BindPathSnooper(); try { args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper());
public Object getProperty(String property) { if (fields.containsKey(property)) { return fields.get(property); } else { BindPathSnooper snooper = new BindPathSnooper(); fields.put(property, snooper); return snooper; } }
public Object getProperty(String property) { if (fields.containsKey(property)) { return fields.get(property); } else { BindPathSnooper snooper = new BindPathSnooper(); fields.put(property, snooper); return snooper; } }
public Object getProperty(String property) { if (fields.containsKey(property)) { return fields.get(property); } else { BindPathSnooper snooper = new BindPathSnooper(); fields.put(property, snooper); return snooper; } }
public Object getProperty(String property) { if (fields.containsKey(property)) { return fields.get(property); } else { BindPathSnooper snooper = new BindPathSnooper(); fields.put(property, snooper); return snooper; } }
public Closure run() { // assume closures have only 1 constructor, of the form (Object, Reference*) Constructor constructor = closureClass.getConstructors()[0]; int paramCount = constructor.getParameterTypes().length; Object[] args = new Object[paramCount]; args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper()); } try { boolean acc = constructor.isAccessible(); constructor.setAccessible(true); Closure localCopy = (Closure) constructor.newInstance(args); if (!acc) { constructor.setAccessible(false); } localCopy.setResolveStrategy(Closure.DELEGATE_ONLY); for (Field f:closureClass.getDeclaredFields()) { acc = f.isAccessible(); f.setAccessible(true); if (f.getType() == Reference.class) { delegate.fields.put(f.getName(), (BindPathSnooper) ((Reference) f.get(localCopy)).get()); } if (!acc) { f.setAccessible(false); } } return localCopy; } catch (Exception e) { throw new RuntimeException("Error snooping closure", e); } } });
public Closure run() { // assume closures have only 1 constructor, of the form (Object, Reference*) Constructor constructor = closureClass.getConstructors()[0]; int paramCount = constructor.getParameterTypes().length; Object[] args = new Object[paramCount]; args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper()); } try { boolean acc = constructor.isAccessible(); constructor.setAccessible(true); Closure localCopy = (Closure) constructor.newInstance(args); if (!acc) { constructor.setAccessible(false); } localCopy.setResolveStrategy(Closure.DELEGATE_ONLY); for (Field f:closureClass.getDeclaredFields()) { acc = f.isAccessible(); f.setAccessible(true); if (f.getType() == Reference.class) { delegate.fields.put(f.getName(), (BindPathSnooper) ((Reference) f.get(localCopy)).get()); } if (!acc) { f.setAccessible(false); } } return localCopy; } catch (Exception e) { throw new RuntimeException("Error snooping closure", e); } } });
public Closure run() { // assume closures have only 1 constructor, of the form (Object, Reference*) Constructor constructor = closureClass.getConstructors()[0]; int paramCount = constructor.getParameterTypes().length; Object[] args = new Object[paramCount]; args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper()); } try { boolean acc = constructor.isAccessible(); constructor.setAccessible(true); Closure localCopy = (Closure) constructor.newInstance(args); if (!acc) { constructor.setAccessible(false); } localCopy.setResolveStrategy(Closure.DELEGATE_ONLY); for (Field f:closureClass.getDeclaredFields()) { acc = f.isAccessible(); f.setAccessible(true); if (f.getType() == Reference.class) { delegate.fields.put(f.getName(), (BindPathSnooper) ((Reference) f.get(localCopy)).get()); } if (!acc) { f.setAccessible(false); } } return localCopy; } catch (Exception e) { throw new RuntimeException("Error snooping closure", e); } } });
public Closure run() { // assume closures have only 1 constructor, of the form (Object, Reference*) Constructor constructor = closureClass.getConstructors()[0]; int paramCount = constructor.getParameterTypes().length; Object[] args = new Object[paramCount]; args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper()); } try { boolean acc = constructor.isAccessible(); constructor.setAccessible(true); Closure localCopy = (Closure) constructor.newInstance(args); if (!acc) { constructor.setAccessible(false); } localCopy.setResolveStrategy(Closure.DELEGATE_ONLY); for (Field f:closureClass.getDeclaredFields()) { acc = f.isAccessible(); f.setAccessible(true); if (f.getType() == Reference.class) { delegate.fields.put(f.getName(), (BindPathSnooper) ((Reference) f.get(localCopy)).get()); } if (!acc) { f.setAccessible(false); } } return localCopy; } catch (Exception e) { throw new RuntimeException("Error snooping closure", e); } } });
throw new RuntimeException("Source binding must the Trigger Binding as well"); final BindPathSnooper delegate = new BindPathSnooper(); try { args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper());
throw new RuntimeException("Source binding must the Trigger Binding as well"); final BindPathSnooper delegate = new BindPathSnooper(); try { args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper());
throw new RuntimeException("Source binding must the Trigger Binding as well"); final BindPathSnooper delegate = new BindPathSnooper(); try { args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper());
throw new RuntimeException("Source binding must the Trigger Binding as well"); final BindPathSnooper delegate = new BindPathSnooper(); try { args[0] = delegate; for (int i = 1; i < paramCount; i++) { args[i] = new Reference(new BindPathSnooper());