Package org.apache.sling.api.resource

# Interface ModifiableValueMap

All Superinterfaces:
  `Map<String,Object>`, `ValueMap`

All Known Implementing Classes:
  `DeepReadModifiableValueMapDecorator`, `ModifiableValueMapDecorator`

@ConsumerType public interface ModifiableValueMap extends ValueMap
The `ModifiableValueMap` is an extension of the `ValueMap` which allows to modify and persist properties. All changes to this map are stored in the transient layer of the resource resolver or more precisely in the transient layer of the resource provider managing this resource.

Once `ResourceResolver.commit()` is called, the changes are finally persisted.

The modifiable value map is only changeable through one of these methods

- `Map.put(Object, Object)`
- `Map.putAll(java.util.Map)`
- `Map.remove(Object)`
- `Map.replace(Object, Object)`
- `Map.replace(Object, Object, Object)`
- `Map.replaceAll(java.util.function.BiFunction)`
- `Map.compute(Object, java.util.function.BiFunction)`
- `Map.computeIfAbsent(Object, java.util.function.Function)`
- `Map.computeIfPresent(Object, java.util.function.BiFunction)`
- `Map.merge(Object, Object, java.util.function.BiFunction)`

The map is not modifiable through the collections provided by

- `Map.entrySet()`
- `Map.keySet()`
- `Map.values()`

And it can't be modified by these methods:

- `Map.clear()`

A modifiable value map should consider property "sling:resourceType" to set the resource type of a resource and "sling:resourceSuperType" to set the optional super type.

A modifiable value map must not support deep writes. A call of a modification method with a path (i.e. a key containing a slash) should result in an `IllegalArgumentException`.

All write methods may throw any `RuntimeException` if the underlying property cannot be written some reason (for example if its type is not supported in that location). All read methods may throw any `RuntimeException` if the underlying property cannot be read for some reason (e.g. if the underlying storage is corrupt).

Since:
  2.2 (Sling API Bundle 2.2.0)

## Nested Class Summary

## Nested classes/interfaces inherited from interface java.util.Map

`Map.Entry<K extends Object,V extends Object>`

## Field Summary

### Fields inherited from interface org.apache.sling.api.resource.ValueMap

`EMPTY`

## Method Summary

### Methods inherited from interface java.util.Map

`clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

### Methods inherited from interface org.apache.sling.api.resource.ValueMap

`get, get`