Class ImmutableValueMap.Builder
- java.lang.Object
-
- org.apache.sling.testing.mock.sling.builder.ImmutableValueMap.Builder
-
- Enclosing class:
- ImmutableValueMap
public static final class ImmutableValueMap.Builder extends Object
Builder interface forImmutableValueMap.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull ImmutableValueMapbuild()Returns a newly-created immutable map.@NotNull ImmutableValueMap.Builderput(@NotNull String key, @NotNull Object value)Associateskeywithvaluein the built map.@NotNull ImmutableValueMap.Builderput(@NotNull Map.Entry<String,Object> entry)Adds the givenentryto the map, making it immutable if necessary.@NotNull ImmutableValueMap.BuilderputAll(@NotNull Map<String,Object> value)Associates all of the given map's keys and values in the built map.
-
-
-
Method Detail
-
put
@NotNull public @NotNull ImmutableValueMap.Builder put(@NotNull @NotNull String key, @NotNull @NotNull Object value)
Associateskeywithvaluein the built map. Duplicate keys are not allowed, and will causebuild()to fail.- Parameters:
key- Keyvalue- value- Returns:
- this
-
put
@NotNull public @NotNull ImmutableValueMap.Builder put(@NotNull @NotNull Map.Entry<String,Object> entry)
Adds the givenentryto the map, making it immutable if necessary. Duplicate keys are not allowed, and will causebuild()to fail.- Parameters:
entry- Entry- Returns:
- this
-
putAll
@NotNull public @NotNull ImmutableValueMap.Builder putAll(@NotNull @NotNull Map<String,Object> value)
Associates all of the given map's keys and values in the built map. Duplicate keys are not allowed, and will causebuild()to fail.- Parameters:
value- Value- Returns:
- this
- Throws:
NullPointerException- if any key or value inmapis null
-
build
@NotNull public @NotNull ImmutableValueMap build()
Returns a newly-created immutable map.- Returns:
- ImmutableValueMap
- Throws:
IllegalArgumentException- if duplicate keys were added
-
-