protected void clearMetadataMap() { if (metadata != null) metadata.clear(); }
@Override public boolean containsValue(Object value) { return containsValue(value); }
/** * Get a metadata value. * * @param key * @param value * @return the metadata value if set, or null if not * * @see storeMetadataValue */ protected Object retrieveMetadataValue(final String key) { return metadata == null ? null : metadata.get(key); }
/** * Store a metadata value. * * Note: This should be used with caution; for objects that could be plentiful (e.g. detections) it is likely * to be unwise to store any metadata values, since these can't be stored particularly efficiently - and * therefore this could lead to far too high memory requirements. * * If metadata is never stored for an object, no storage object is created - only a null reference. * * Therefore the intention is that some newly-defined PathObject classes may take advantage of this mechanism and expose their * own API for getting/setting values, backed-up by this store (which takes care of serialization/deserialization). * However class definitions can also avoid making any use of this whatsoever if it's expected that it could lead to too much * memory being required. * * @param key * @param value * * @see retrieveMetadataValue */ protected Object storeMetadataValue(final String key, final String value) { if (metadata == null) metadata = new MetadataMap(); return metadata.put(key, value); }
/** * Get the set of metadata keys. * * @return */ protected Set<String> retrieveMetadataKeys() { return metadata == null ? Collections.emptySet() : metadata.keySet(); }