/** * Gets the value at the specified key, checking for null * @param key the key to find * @return the value at the key * @throws AttributeUndefinedException if the key doesn't exist or if its value is null */ public Object getNotNull(final String key) { // TODO: If the documentation for this class is correct, AttributeMap does not support null // values. If that is true, this method should be removed. Object result = this.get(key); if (result == null) { throw new AttributeUndefinedException(key); } return result; }
/** * Gets the value of a key * @param key the key to find * @return the value at the specified key * @throws AttributeUndefinedException if the key doesn't exist */ public Object get(final String key) { if (this.hasAttribute(key)) { AttributeHolder attribute = attributes.get(key); return (attribute == null) ? attribute : attribute.getValue(); } throw new AttributeUndefinedException(key); }