public void setProperty(String property, Object newValue) { // always use the expando properties getProperties().put(property, newValue); }
public List getMetaPropertyValues() { // run through all our current properties and create MetaProperty objects List ret = new ArrayList(); for (Object o : getProperties().entrySet()) { Entry entry = (Entry) o; ret.add(new MetaExpandoProperty(entry)); } return ret; }
public Object getProperty(String property) { // always use the expando properties first Object result = getProperties().get(property); if (result != null) return result; try { return super.getProperty(property); } catch (MissingPropertyException e) { // IGNORE } return null; }
/** * This allows equals to be overridden by a closure <i>field</i> method attached * to the expando object. * * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { Object method = getProperties().get("equals"); if (method instanceof Closure) { // invoke overridden equals closure method Closure closure = (Closure) method; closure.setDelegate(this); Boolean ret = (Boolean) closure.call(obj); return ret.booleanValue(); } else { return super.equals(obj); } }
/** * This allows toString to be overridden by a closure <i>field</i> method attached * to the expando object. * * @see java.lang.Object#toString() */ public String toString() { Object method = getProperties().get("toString"); if (method instanceof Closure) { // invoke overridden toString closure method Closure closure = (Closure) method; closure.setDelegate(this); return closure.call().toString(); } else { return expandoProperties.toString(); } }
/** * This allows hashCode to be overridden by a closure <i>field</i> method attached * to the expando object. * * @see java.lang.Object#hashCode() */ public int hashCode() { Object method = getProperties().get("hashCode"); if (method instanceof Closure) { // invoke overridden hashCode closure method Closure closure = (Closure) method; closure.setDelegate(this); Integer ret = (Integer) closure.call(); return ret.intValue(); } else { return super.hashCode(); } }
/** * @return an object representation of an Expando */ public static String toJson(Expando expando) { if (expando == null) { return NULL_VALUE; } CharBuf buffer = CharBuf.create(255); writeMap(expando.getProperties(), buffer); return buffer.toString(); }
writeMap(JsonDelegate.cloneDelegateAndGetContent((Closure<?>) object), buffer); } else if (Expando.class.isAssignableFrom(objectClass)) { writeMap(((Expando) object).getProperties(), buffer); } else if (Enumeration.class.isAssignableFrom(objectClass)) { List<?> list = Collections.list((Enumeration<?>) object);
writeMap(JsonDelegate.cloneDelegateAndGetContent((Closure<?>) object), buffer); } else if (Expando.class.isAssignableFrom(objectClass)) { writeMap(((Expando) object).getProperties(), buffer); } else if (Enumeration.class.isAssignableFrom(objectClass)) { List<?> list = Collections.list((Enumeration<?>) object);
public void setProperty(String property, Object newValue) { // always use the expando properties getProperties().put(property, newValue); }
public void setProperty(String property, Object newValue) { // always use the expando properties getProperties().put(property, newValue); }
public void setProperty(String property, Object newValue) { // always use the expando properties getProperties().put(property, newValue); }
public List getMetaPropertyValues() { // run through all our current properties and create MetaProperty objects List ret = new ArrayList(); Iterator itr = getProperties().entrySet().iterator(); while(itr.hasNext()) { Entry entry = (Entry) itr.next(); ret.add(new MetaExpandoProperty(entry)); } return ret; }
public Object getProperty(String property) { // always use the expando properties first Object result = getProperties().get(property); if (result != null) return result; try { return super.getProperty(property); } catch (MissingPropertyException e) { // IGNORE } return null; }
public List getMetaPropertyValues() { // run through all our current properties and create MetaProperty objects List ret = new ArrayList(); Iterator itr = getProperties().entrySet().iterator(); while(itr.hasNext()) { Entry entry = (Entry) itr.next(); ret.add(new MetaExpandoProperty(entry)); } return ret; }
public Object getProperty(String property) { // always use the expando properties first Object result = getProperties().get(property); if (result!=null) return result; try { return super.getProperty(property); } catch (MissingPropertyException e) { // IGNORE } return null; }
public Object getProperty(String property) { // always use the expando properties first Object result = getProperties().get(property); if (result!=null) return result; try { return super.getProperty(property); } catch (MissingPropertyException e) { // IGNORE } return null; }
public Object getProperty(String property) { // always use the expando properties first Object result = getProperties().get(property); if (result!=null) return result; try { return super.getProperty(property); } catch (MissingPropertyException e) { // IGNORE } return null; }
public List getMetaPropertyValues() { // run through all our current properties and create MetaProperty objects List ret = new ArrayList(); for (Object o : getProperties().entrySet()) { Entry entry = (Entry) o; ret.add(new MetaExpandoProperty(entry)); } return ret; }
public List getMetaPropertyValues() { // run through all our current properties and create MetaProperty objects List ret = new ArrayList(); Iterator itr = getProperties().entrySet().iterator(); while(itr.hasNext()) { Entry entry = (Entry) itr.next(); ret.add(new MetaExpandoProperty(entry)); } return ret; }