public HashMap<String, Object> getProperties() { return properties(); }
/** Returns the new values of any changed properties. */ public List<Object> getNewValues() { ArrayList newValues = new ArrayList(); for (String propertyName : getDirtyProperties()) { newValues.add(properties().get(propertyName)); } return newValues; }
/** Flag which indicates whether any properties of the object being proxied are changed. */ public boolean isDirty() { boolean dirty = false; for (Iterator i = properties().entrySet().iterator(); i.hasNext() && !dirty; ) { Map.Entry e = (Map.Entry) i.next(); if (e.getValue() instanceof Proxy) { ModificationProxy h = handler(e.getValue()); if (h != null && !h.isDirty()) { continue; } } else { try { Object orig = unwrap(getter((String) e.getKey()).invoke(proxyObject, null)); if (orig == null) { if (e.getValue() == null) { continue; } } else if (e.getValue() != null && orig.equals(e.getValue())) { continue; } } catch (Exception ex) { throw new RuntimeException(ex); } } dirty = true; } return dirty; }
List<String> getDirtyProperties() { List<String> propertyNames = new ArrayList<String>(); for (String propertyName : properties().keySet()) { // in the case this property is another proxy, check that it is actually dirty Object value = properties.get(propertyName); if (value instanceof Proxy) { ModificationProxy h = handler(value); if (h != null && !h.isDirty()) { // proxy reports it is not dirty, only return this property if the underling // value is not the same as the current value of the property on the object Object curr = unwrap(value); try { Object orig = unwrap(getter(propertyName).invoke(proxyObject, null)); if (curr == orig) { continue; } } catch (Exception e) { throw new RuntimeException(e); } } } propertyNames.add(propertyName); } return propertyNames; }
if (properties != null && properties().containsKey(property)) { return properties().get(property); } else { properties().put(property, wrap); properties().put(property, wrap); properties().put(property, args[0]); properties().put(property, result);
synchronized (proxyObject) { for (Map.Entry<String, Object> e : properties().entrySet()) { String p = e.getKey(); Object v = e.getValue();