List of usage examples for java.util Map remove
V remove(Object key);
From source file:io.brooklyn.camp.spi.pdp.ArtifactRequirement.java
public static ArtifactRequirement of(Map<String, Object> req) { Map<String, Object> attrs = MutableMap.copyOf(req); ArtifactRequirement result = new ArtifactRequirement(); result.name = (String) attrs.remove("name"); result.description = (String) attrs.remove("description"); result.requirementType = (String) (String) Yamls.removeMultinameAttribute(attrs, "requirementType", "type"); // TODO fulfillment result.customAttributes = attrs;/*from w w w. jav a 2s . c o m*/ return result; }
From source file:io.brooklyn.camp.spi.pdp.ArtifactContent.java
public static ArtifactContent of(Object spec) { if (spec == null) return null; ArtifactContent result = new ArtifactContent(); if (spec instanceof String) { result.href = (String) spec; } else if (spec instanceof Map) { @SuppressWarnings("unchecked") Map<String, Object> attrs = MutableMap.copyOf((Map<String, Object>) spec); result.href = (String) attrs.remove("href"); result.customAttributes = attrs; } else {/*from ww w.ja v a2 s .com*/ throw new IllegalArgumentException("artifact content should be map or string, not " + spec.getClass()); } return result; }
From source file:io.brooklyn.camp.spi.pdp.ServiceCharacteristic.java
public static ServiceCharacteristic of(Map<String, Object> req) { Map<String, Object> attrs = MutableMap.copyOf(req); ServiceCharacteristic result = new ServiceCharacteristic(); result.name = (String) attrs.remove("name"); result.description = (String) attrs.remove("description"); result.characteristicType = (String) Yamls.removeMultinameAttribute(attrs, "characteristicType", "type"); // TODO fulfillment result.customAttributes = attrs;//from w ww .j a va2 s. co m return result; }
From source file:org.apache.synapse.util.MediatorPropertyUtils.java
/** * This method removes the current content-type header value from the Axis2 message context and * set the given value.//from w w w. j ava 2 s . c om * @param propertyName Message type property * @param resultValue Value to be set * @param axis2MessageCtx Axis2 message context */ public static void handleSpecialProperties(String propertyName, Object resultValue, org.apache.axis2.context.MessageContext axis2MessageCtx) { if (org.apache.axis2.Constants.Configuration.MESSAGE_TYPE.equals(propertyName)) { axis2MessageCtx.setProperty(org.apache.axis2.Constants.Configuration.CONTENT_TYPE, resultValue); Map headers = (Map) axis2MessageCtx .getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS); if (headers != null) { headers.remove(HTTP.CONTENT_TYPE); headers.put(HTTP.CONTENT_TYPE, resultValue); } } }
From source file:com.softwarementors.extjs.djn.router.processor.standard.form.FormPostRequestProcessorBase.java
private static String getAndRemove(Map<String, String> keyValues, String key) { String result = keyValues.get(key); keyValues.remove(key); return result; }
From source file:com.streamsets.pipeline.stage.origin.spooldir.TestOffsetUtil.java
static void compare(String offsetV1, Map<String, String> offsetV2, boolean removeAbsolutePaths) { try {/*from ww w. ja v a 2 s. c o m*/ Offset offset = new Offset(VERSION_ONE, offsetV1); offsetV2.remove(OFFSET_VERSION); if (removeAbsolutePaths) { offsetV2 = removeAbsolutePaths(offsetV2); } Assert.assertTrue(String.format("offset does not contain file: %s", offset.getFile()), offsetV2.containsKey(offset.getFile())); Assert.assertEquals(offset.getOffset(), OffsetUtil.deserializeOffsetMap(offsetV2.get(offset.getFile())).get(POS)); Assert.assertEquals(offset.getOffsetString(), offsetV2.get(offset.getFile())); } catch (Exception ex) { Assert.fail(ex.toString()); } }
From source file:melnorme.utilbox.tests.CommonTestExt.java
protected static <K, V> void checkMapContains(Map<K, V> map, K key, V expectedValue) { assertTrue(map.containsKey(key));/* w w w.jav a 2s . c o m*/ V value = map.remove(key); assertAreEqual(value, expectedValue); }
From source file:net.sourceforge.atunes.utils.ReflectionUtils.java
/** * Returns map with properties and values of given object * /*from w w w .j a va 2 s. com*/ * @param bean * @return */ @SuppressWarnings("unchecked") public static Map<String, String> describe(final Object bean) { try { Map<String, String> description = PropertyUtils.describe(bean); description.remove("class"); return description; } catch (IllegalAccessException e) { Logger.error(e); } catch (InvocationTargetException e) { Logger.error(e); } catch (NoSuchMethodException e) { Logger.error(e); } return null; }
From source file:io.brooklyn.camp.spi.pdp.Service.java
@SuppressWarnings("unchecked") public static Service of(Map<String, Object> service) { Map<String, Object> fields = MutableMap.copyOf(service); Service result = new Service(); result.name = (String) fields.remove("name"); result.description = (String) fields.remove("description"); // FIXME _type needed in lots of places result.serviceType = (String) Yamls.removeMultinameAttribute(fields, "service_type", "serviceType", "type"); result.characteristics = new ArrayList<ServiceCharacteristic>(); Object chars = fields.remove("characteristics"); if (chars instanceof Iterable) { for (Object req : (Iterable<Object>) chars) { if (req instanceof Map) { result.characteristics.add(ServiceCharacteristic.of((Map<String, Object>) req)); } else { throw new IllegalArgumentException("characteristics should be a map, not " + req.getClass()); }/*from ww w . ja v a2s .co m*/ } } else if (chars != null) { // TODO "map" short form throw new IllegalArgumentException("services body should be iterable, not " + chars.getClass()); } result.customAttributes = fields; return result; }
From source file:ai.susi.tools.JsonSignature.java
public static void removeSignature(Map<String, byte[]> obj) { if (obj.containsKey(signatureString)) obj.remove(signatureString); }