/** * Returns a Map with the IChemObject's properties.I should * integrate into ChemObject. * *@return The object's properties as an Hashtable *@see #setProperties */ @Override public Map<Object, Object> getProperties() { return lazyProperties(); }
/** * Returns a Map with the IChemObject's properties.I should * integrate into ChemObject. * *@return The object's properties as an Hashtable *@see #setProperties */ @Override public Map<Object, Object> getProperties() { return lazyProperties(); }
/** *{@inheritDoc} */ @Override public <T> T getProperty(Object description) { if (properties == null) return null; // can't check the type @SuppressWarnings("unchecked") T value = (T) lazyProperties().get(description); return value; }
/** *{@inheritDoc} */ @Override public <T> T getProperty(Object description) { if (properties == null) return null; // can't check the type @SuppressWarnings("unchecked") T value = (T) lazyProperties().get(description); return value; }
/** * Sets a property for a IChemObject. I should * integrate into ChemObject. * *@param description An object description of the property (most likely a * unique string) *@param property An object with the property itself *@see #getProperty *@see #removeProperty */ @Override public void setProperty(Object description, Object property) { lazyProperties().put(description, property); }
/** * Sets a property for a IChemObject. I should * integrate into ChemObject. * *@param description An object description of the property (most likely a * unique string) *@param property An object with the property itself *@see #getProperty *@see #removeProperty */ @Override public void setProperty(Object description, Object property) { lazyProperties().put(description, property); }
/** * Removes a property for a IChemObject. I should * integrate into ChemObject. * *@param description The object description of the property (most likely a * unique string) *@see #setProperty *@see #getProperty */ @Override public void removeProperty(Object description) { if (properties == null) { return; } lazyProperties().remove(description); }
/** * Removes a property for a IChemObject. I should * integrate into ChemObject. * *@param description The object description of the property (most likely a * unique string) *@see #setProperty *@see #getProperty */ @Override public void removeProperty(Object description) { if (properties == null) { return; } lazyProperties().remove(description); }
/** * Sets the properties of this object. * *@param properties a Hashtable specifying the property values *@see #getProperties */ @Override public void setProperties(Map<Object, Object> properties) { Iterator<Object> keys = properties.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); lazyProperties().put(key, properties.get(key)); } }
/** *{@inheritDoc} */ @Override public <T> T getProperty(Object description, Class<T> c) { Object value = lazyProperties().get(description); if (c.isInstance(value)) { @SuppressWarnings("unchecked") T typed = (T) value; return typed; } else if (value != null) { throw new IllegalArgumentException("attempted to access a property of incorrect type, expected " + c.getSimpleName() + " got " + value.getClass().getSimpleName()); } return null; }
/** * Sets the properties of this object. * *@param properties a Hashtable specifying the property values *@see #getProperties */ @Override public void setProperties(Map<Object, Object> properties) { Iterator<Object> keys = properties.keySet().iterator(); while (keys.hasNext()) { Object key = keys.next(); lazyProperties().put(key, properties.get(key)); } }
/** *{@inheritDoc} */ @Override public <T> T getProperty(Object description, Class<T> c) { Object value = lazyProperties().get(description); if (c.isInstance(value)) { @SuppressWarnings("unchecked") T typed = (T) value; return typed; } else if (value != null) { throw new IllegalArgumentException("attempted to access a property of incorrect type, expected " + c.getSimpleName() + " got " + value.getClass().getSimpleName()); } return null; }