/** * 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; }
/** * 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; }
/** * @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; }
/** * Removes a metadata item from the object. * * @param name * the name of the metadata item to remove, case-insensitive. */ public void removeMetadata(String name) { String existingItemKey = null; for (Entry<String, Object> entry: this.metadata.entrySet()) { if (isMatchingMetadataName(entry.getKey(), name)) { existingItemKey = entry.getKey(); } } // Remove existing matching entry, if present. if (existingItemKey != null || name == null) { this.metadata.remove(existingItemKey); } }
/** * @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; }
/** * Removes a metadata item from the object. * * @param name * the name of the metadata item to remove, case-insensitive. */ public void removeMetadata(String name) { String existingItemKey = null; for (Entry<String, Object> entry: this.metadata.entrySet()) { if (isMatchingMetadataName(entry.getKey(), name)) { existingItemKey = entry.getKey(); } } // Remove existing matching entry, if present. if (existingItemKey != null || name == null) { this.metadata.remove(existingItemKey); } }