/** * Sets the value of a key. * * @param key the key * @param value the value (if null the key will be deleted) */ public void set(final String key, final String value) { // Null = delete if (value == null) { remove(key); return; } // Do we have any existing metadata this this key? final Optional<Metadata> mdFound = metadata.findMetadata(key); // If so, update or else create Metadata md; if (mdFound.isPresent()) { md = mdFound.get(); md.setValue(value); } else { md = new Metadata(jCas); md.setBegin(0); md.setEnd(1); md.setKey(key); md.setValue(value); } md.addToIndexes(); }
/** * Sets the value of a key. * * @param key the key * @param value the value (if null the key will be deleted) */ public void set(final String key, final String value) { // Null = delete if (value == null) { remove(key); return; } // Do we have any existing metadata this this key? final Optional<Metadata> mdFound = metadata.findMetadata(key); // If so, update or else create Metadata md; if (mdFound.isPresent()) { md = mdFound.get(); md.setValue(value); } else { md = new Metadata(jCas); md.setBegin(0); md.setEnd(1); md.setKey(key); md.setValue(value); } md.addToIndexes(); }