Interface DocPropertyHolder.Mutable<S extends DocPropertyHolder.Mutable<S>>

Type Parameters:
S - the type that implements this interface, for chainable method return types.
All Superinterfaces:
DocPropertyHolder
All Known Subinterfaces:
DefaultedDocPropertyHolder.Mutable<S>, DefaultedDocPropertyHolder.Mutable.WithDirectModifier<S>, Document.Mutable
All Known Implementing Classes:
GroupConfiguration.Builder, ServiceConfiguration.Builder, ServiceConfigurationBase.Builder, ServiceTask.Builder
Enclosing interface:
DocPropertyHolder

public static interface DocPropertyHolder.Mutable<S extends DocPropertyHolder.Mutable<S>> extends DocPropertyHolder
A mutable version of a doc property holder which allows modifications to it.
Since:
4.0
  • Method Details

    • writeProperty

      @NonNull <E> S writeProperty(@NonNull @NonNull DocProperty<E> property, @Nullable E value)
      Writes the given property and value into the underlying document.
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to write.
      value - the value to associate with the given property.
      Returns:
      this property holder, for chaining.
      Throws:
      NullPointerException - if the given doc property is null.
      UnsupportedOperationException - if the given doc property does not support writing.
    • writePropertyIfAbsent

      @NonNull <E> S writePropertyIfAbsent(@NonNull @NonNull DocProperty<E> property, @Nullable E value)
      Writes the given property and value into the underlying document if no other value is associated yet with the given property.
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to write.
      value - the value to associate with the given property in case no other value is associated yet.
      Returns:
      this property holder, for chaining.
      Throws:
      NullPointerException - if the given doc property is null.
      UnsupportedOperationException - if the given doc property does not support writing.
    • writePropertyIfAbsent

      @NonNull <E> S writePropertyIfAbsent(@NonNull @NonNull DocProperty<E> property, @NonNull @NonNull Supplier<? extends E> valueSupplier)
      Writes the given property and computed value into the underlying document if no other value is associated yet with the given property.
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to write.
      valueSupplier - a supplier for the value to associate if no other value is yet associated.
      Returns:
      this property holder, for chaining.
      Throws:
      NullPointerException - if the given doc property or value supplier is null.
      UnsupportedOperationException - if the given doc property does not support writing.
    • writePropertyIfPresent

      @NonNull <E> S writePropertyIfPresent(@NonNull @NonNull DocProperty<E> property, @Nullable E value)
      Writes the given property and value into the underlying document if another value is already associated with the given property.
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to write.
      value - the value to associate with the given property in case another value is already associated.
      Returns:
      this property holder, for chaining.
      Throws:
      NullPointerException - if the given doc property is null.
      UnsupportedOperationException - if the given doc property does not support writing.
    • writePropertyIfPresent

      @NonNull <E> S writePropertyIfPresent(@NonNull @NonNull DocProperty<E> property, @NonNull @NonNull Supplier<? extends E> valueSupplier)
      Writes the given property and computed value into the underlying document if another value is already associated with the given property.
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to write.
      valueSupplier - a supplier for the value to associate if another value is already associated.
      Returns:
      this property holder, for chaining.
      Throws:
      NullPointerException - if the given doc property or value supplier is null.
      UnsupportedOperationException - if the given doc property does not support writing.
    • removeProperty

      <E> @UnknownNullability E removeProperty(@NonNull @NonNull DocProperty<E> property)
      Removes the given doc property from the underlying document.
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to remove.
      Returns:
      the old value associated with the given doc property.
      Throws:
      NullPointerException - if the given property is null.
      UnsupportedOperationException - if the given doc property is read-only.
    • propertyHolder

      @NonNull Document.Mutable propertyHolder()
      Get the underlying document that all read and write operations are delegated to.
      Specified by:
      propertyHolder in interface DocPropertyHolder
      Returns:
      the underlying document.