/** * Add an attribute to the request. * * @param key The key of the attribute to add. * @param value The value of the attribute to add. * @param <T> The type of the attribute to add. * @return the request builder with extra attribute */ public <T> RequestBuilder attr(TypedKey<T> key, T value) { req = req.addAttr(key.asScala(), value); return this; }
/** * Get a value from the map, throwing an exception if it is not present. * * @param key The key for the value to retrieve. * @param <A> The type of value to retrieve. * @return The value, if it is present in the map. * @throws java.util.NoSuchElementException If the value isn't present in the map. */ public <A> A get(TypedKey<A> key) { return underlying.apply(key.asScala()); }
/** * Add an attribute to the request. * * @param key The key of the attribute to add. * @param value The value of the attribute to add. * @param <T> The type of the attribute to add. * @return the request builder with extra attribute */ public <T> RequestBuilder attr(TypedKey<T> key, T value) { req = req.addAttr(key.asScala(), value); return this; }
/** * Add an attribute to the request. * * @param key The key of the attribute to add. * @param value The value of the attribute to add. * @param <T> The type of the attribute to add. * @return the request builder with extra attribute */ public <T> RequestBuilder attr(TypedKey<T> key, T value) { req = req.addAttr(key.asScala(), value); return this; }
/** * Get a value from the map, throwing an exception if it is not present. * * @param key The key for the value to retrieve. * @param <A> The type of value to retrieve. * @return The value, if it is present in the map. * @throws java.util.NoSuchElementException If the value isn't present in the map. */ public <A> A get(TypedKey<A> key) { return underlying.apply(key.asScala()); }
/** * Check if the map contains a value with the given key. * * @param key The key to check for. * @return True if the value is present, false otherwise. */ public boolean containsKey(TypedKey<?> key) { return underlying.contains(key.asScala()); }
/** * Check if the map contains a value with the given key. * * @param key The key to check for. * @return True if the value is present, false otherwise. */ public boolean containsKey(TypedKey<?> key) { return underlying.contains(key.asScala()); }
/** * Get a value from the map, throwing an exception if it is not present. * * @param key The key for the value to retrieve. * @param <A> The type of value to retrieve. * @return The value, if it is present in the map. * @throws java.util.NoSuchElementException If the value isn't present in the map. */ public <A> A get(TypedKey<A> key) { return underlying.apply(key.asScala()); }
/** * Check if the map contains a value with the given key. * * @param key The key to check for. * @return True if the value is present, false otherwise. */ public boolean containsKey(TypedKey<?> key) { return underlying.contains(key.asScala()); }
/** * Update the map with the given key and value, returning a new instance of the map. * * @param key The key to set. * @param value The value to use. * @param <A> The type of value. * @return A new instance of the map with the new entry added. */ public <A> TypedMap put(TypedKey<A> key, A value) { return new TypedMap(underlying.updated(key.asScala(), value)); }
/** * Update the map with the given key and value, returning a new instance of the map. * * @param key The key to set. * @param value The value to use. * @param <A> The type of value. * @return A new instance of the map with the new entry added. */ public <A> TypedMap put(TypedKey<A> key, A value) { return new TypedMap(underlying.updated(key.asScala(), value)); }
/** * Update the map with the given key and value, returning a new instance of the map. * * @param key The key to set. * @param value The value to use. * @param <A> The type of value. * @return A new instance of the map with the new entry added. */ public <A> TypedMap put(TypedKey<A> key, A value) { return new TypedMap(underlying.updated(key.asScala(), value)); }
/** * Get a value from the map, returning an empty {@link Optional} if it is not present. * * @param key The key for the value to retrieve. * @param <A> The type of value to retrieve. * @return An <code>Optional</code>, with the value present if it is in the map. */ public <A> Optional<A> getOptional(TypedKey<A> key) { return OptionConverters.toJava(underlying.get(key.asScala())); }
/** * Get a value from the map, returning an empty {@link Optional} if it is not present. * * @param key The key for the value to retrieve. * @param <A> The type of value to retrieve. * @return An <code>Optional</code>, with the value present if it is in the map. */ public <A> Optional<A> getOptional(TypedKey<A> key) { return OptionConverters.toJava(underlying.get(key.asScala())); }
/** * Get a value from the map, returning an empty {@link Optional} if it is not present. * * @param key The key for the value to retrieve. * @param <A> The type of value to retrieve. * @return An <code>Optional</code>, with the value present if it is in the map. */ public <A> Optional<A> getOptional(TypedKey<A> key) { return OptionConverters.toJava(underlying.get(key.asScala())); }
/** * Removes keys from the map, returning a new instance of the map. * * @param keys The keys to remove. * @return A new instance of the map with the entries removed. */ public TypedMap remove(TypedKey<?>... keys) { play.api.libs.typedmap.TypedMap newUnderlying = underlying; for (TypedKey<?> k : keys) { newUnderlying = newUnderlying.$minus(Scala.varargs(k.asScala())); } return new TypedMap(newUnderlying); }
/** * Removes keys from the map, returning a new instance of the map. * * @param keys The keys to remove. * @return A new instance of the map with the entries removed. */ public TypedMap remove(TypedKey<?>... keys) { play.api.libs.typedmap.TypedMap newUnderlying = underlying; for (TypedKey<?> k : keys) { newUnderlying = newUnderlying.$minus(Scala.varargs(k.asScala())); } return new TypedMap(newUnderlying); }
/** * Update the map with several entries, returning a new instance of the map. * * @param entries The new entries to add to the map. * @return A new instance of the map with the new entries added. */ public TypedMap putAll(TypedEntry<?>... entries) { play.api.libs.typedmap.TypedMap newUnderlying = underlying; for (TypedEntry<?> e : entries) { newUnderlying = newUnderlying.updated(((TypedKey<Object>) e.key()).asScala(), e.value()); } return new TypedMap(newUnderlying); }
/** * Update the map with several entries, returning a new instance of the map. * * @param entries The new entries to add to the map. * @return A new instance of the map with the new entries added. */ public TypedMap putAll(TypedEntry<?>... entries) { play.api.libs.typedmap.TypedMap newUnderlying = underlying; for (TypedEntry<?> e : entries) { newUnderlying = newUnderlying.updated(((TypedKey<Object>) e.key()).asScala(), e.value()); } return new TypedMap(newUnderlying); }
/** * Update the map with several entries, returning a new instance of the map. * * @param entries The new entries to add to the map. * @return A new instance of the map with the new entries added. */ public TypedMap putAll(TypedEntry<?>... entries) { play.api.libs.typedmap.TypedMap newUnderlying = underlying; for (TypedEntry<?> e : entries) { newUnderlying = newUnderlying.updated(((TypedKey<Object>) e.key()).asScala(), e.value()); } return new TypedMap(newUnderlying); }