/** * Adds a Date metadata item to the object. * * @param name * the metadata item name, case-insensitive. * @param value * the metadata item's date value. */ public void addMetadata(String name, Date value) { this.addMetadata(name, (Object) value); }
/** * @param name * the metadata item name, case-insensitive. * * @return * the value of the metadata with the given case-insensitive name, or * null if no such metadata item exists. */ public Object getMetadata(String name) { // Prefer metadata values set from HTTP response headers if one is // available, to solve problems with user-set metadata clobbering // the definitive values received from HTTP, see #213 Object httpMetadataValue = getHttpMetadata(name); if (httpMetadataValue != null) { return httpMetadataValue; } return getMetadataCaseInsensitiveFromMap(name, this.metadata); }
/** * @param name * the metadata item name, case-insensitive. * * @return * the value of the metadata with the given case-insensitive name within * the *user-set* metadata items -- that is, not from HTTP headers returned * by the service -- or null if no such metadata item exists. */ public Object getHttpMetadata(String name) { return getMetadataCaseInsensitiveFromMap(name, getHttpMetadataMap()); }
/** * @param name * the metadata item name, case-insensitive. * * @return * the value of the metadata with the given case-insensitive name within * the *service-supplied* metadata items -- that is, from HTTP headers not * user-set metadata values -- or null if no such metadata item exists. */ public Object getServiceMetadata(String name) { return getMetadataCaseInsensitiveFromMap(name, getServiceMetadataMap()); }
/** * @param name * the metadata item name, case-insensitive. * * @return * the value of the metadata with the given case-insensitive name within * the *user-set* metadata items -- that is, not from HTTP headers returned * by the service -- or null if no such metadata item exists. */ public Object getUserMetadata(String name) { return getMetadataCaseInsensitiveFromMap(name, getUserMetadataMap()); }
/** * @return * an <b>immutable</b> map containing the HTTP metadata associated with this object, * with case-sensitive name strings as keys. * Note: this map will not be populated in all cases where basic metadata is available * from {@link #getMetadata(String)}. */ public Map<String, Object> getHttpMetadataMap() { return lookupMetadataSubsetMap(Constants.KEY_FOR_HTTP_METADATA); }
/** * Return true if a metdata data item with the given name (case-insensitive) * is present. * * @param name * the metadata item name, case-insensitive. * * @return * true if this object contains a metadata item with the given name, false otherwise. */ public boolean containsMetadata(String name) { for (Entry<String, Object> entry: this.metadata.entrySet()) { if (isMatchingMetadataName(entry.getKey(), name)) { return true; } } return false; }
/** * Removes all the metadata items associated with this object, then adds all the items * in the provided map. After performing this operation, the metadata list will contain * only those items in the provided map. * * @param metadata * metadata items to add. */ public void replaceAllMetadata(Map<String, Object> metadata) { this.metadata.clear(); this.addAllMetadata(metadata); }
/** * @return * the key of this object. */ public String getKey() { return super.getName(); }
/** * @param name * the metadata item name, case-insensitive. * * @return * the value of the metadata with the given case-insensitive name within * the *service-supplied* metadata items -- that is, from HTTP headers not * user-set metadata values -- or null if no such metadata item exists. */ public Object getServiceMetadata(String name) { return getMetadataCaseInsensitiveFromMap(name, getServiceMetadataMap()); }
/** * @return * an <b>immutable</b> map containing the complete metadata associated with this object, * with case-sensitive name strings as keys. * Note: this map will not be populated in all cases where basic metadata is available * from {@link #getMetadata(String)}. */ public Map<String, Object> getCompleteMetadataMap() { return lookupMetadataSubsetMap(Constants.KEY_FOR_COMPLETE_METADATA); }
/** * @param name * the metadata item name, case-insensitive. * * @return * the value of the metadata with the given case-insensitive name within * the *user-set* metadata items -- that is, not from HTTP headers returned * by the service -- or null if no such metadata item exists. */ public Object getUserMetadata(String name) { return getMetadataCaseInsensitiveFromMap(name, getUserMetadataMap()); }
/** * Return true if a metdata data item with the given name (case-insensitive) * is present. * * @param name * the metadata item name, case-insensitive. * * @return * true if this object contains a metadata item with the given name, false otherwise. */ public boolean containsMetadata(String name) { for (Entry<String, Object> entry: this.metadata.entrySet()) { if (isMatchingMetadataName(entry.getKey(), name)) { return true; } } return false; }
/** * Removes all the metadata items associated with this object, then adds all the items * in the provided map. After performing this operation, the metadata list will contain * only those items in the provided map. * * @param metadata * metadata items to add. */ public void replaceAllMetadata(Map<String, Object> metadata) { this.metadata.clear(); this.addAllMetadata(metadata); }
/** * @return * the key of this object. */ public String getKey() { return super.getName(); }
/** * Adds a String metadata item to the object. * * @param name * the metadata item name, case-insensitive. * @param value * the metadata item's date value. */ public void addMetadata(String name, String value) { this.addMetadata(name, (Object) value); }
/** * @param name * the metadata item name, case-insensitive. * * @return * the value of the metadata with the given case-insensitive name within * the *user-set* metadata items -- that is, not from HTTP headers returned * by the service -- or null if no such metadata item exists. */ public Object getHttpMetadata(String name) { return getMetadataCaseInsensitiveFromMap(name, getHttpMetadataMap()); }
/** * @return * an <b>immutable</b> map containing the service metadata associated with this object, * with case-sensitive name strings as keys. * Note: this map will not be populated in all cases where basic metadata is available * from {@link #getMetadata(String)}. */ public Map<String, Object> getServiceMetadataMap() { return lookupMetadataSubsetMap(Constants.KEY_FOR_SERVICE_METADATA); }
/** * @param name * the metadata item name, case-insensitive. * * @return * the value of the metadata with the given case-insensitive name, or * null if no such metadata item exists. */ public Object getMetadata(String name) { // Prefer metadata values set from HTTP response headers if one is // available, to solve problems with user-set metadata clobbering // the definitive values received from HTTP, see #213 Object httpMetadataValue = getHttpMetadata(name); if (httpMetadataValue != null) { return httpMetadataValue; } return getMetadataCaseInsensitiveFromMap(name, this.metadata); }
/** * @param name * the metadata item name, case-insensitive. * * @return * the value of the first item found with the given case-insensitive name * in the map, or null if no such name exists in the map */ protected Object getMetadataCaseInsensitiveFromMap( String name, Map<String, Object> map) { for (Entry<String, Object> entry: map.entrySet()) { if (isMatchingMetadataName(entry.getKey(), name)) { return entry.getValue(); } } return null; }