Interface DefaultedDocPropertyHolder

All Superinterfaces:
DocPropertyHolder
All Known Subinterfaces:
DefaultedDocPropertyHolder.Mutable<S>, DefaultedDocPropertyHolder.Mutable.WithDirectModifier<S>
All Known Implementing Classes:
DriverEnvironment, GroupConfiguration, GroupConfiguration.Builder, NetworkClusterNode, NodeInfoSnapshot, ServiceConfiguration, ServiceConfiguration.Builder, ServiceConfigurationBase, ServiceConfigurationBase.Builder, ServiceDeployment, ServiceEnvironmentType, ServiceInfoSnapshot, ServiceRemoteInclusion, ServiceTask, ServiceTask.Builder

public interface DefaultedDocPropertyHolder extends DocPropertyHolder
An implementation of a doc property holder that defaults all method calls to the underlying document that is returned by the DocPropertyHolder.propertyHolder() method.
Since:
4.0
  • Method Details

    • readProperty

      default <E> @UnknownNullability E readProperty(@NonNull @NonNull DocProperty<E> property)
      Reads the value of the given property from the underlying document.
      Specified by:
      readProperty in interface DocPropertyHolder
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to read.
      Returns:
      the value of the property.
    • readPropertyOrDefault

      default <E> @UnknownNullability E readPropertyOrDefault(@NonNull @NonNull DocProperty<E> property, @Nullable E def)
      Reads the given property from the underlying document or returns the given default value if the property is not set or set to null.
      Specified by:
      readPropertyOrDefault in interface DocPropertyHolder
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to read.
      def - the default value to return if the property value is null.
      Returns:
      the value of the property or the given default value.
    • readPropertyOrGet

      default <E> @UnknownNullability E readPropertyOrGet(@NonNull @NonNull DocProperty<E> property, @NonNull @NonNull Supplier<? extends E> supplier)
      Reads the given property from the underlying document or returns the default value computed by the given supplier if the property is not set or set to null.
      Specified by:
      readPropertyOrGet in interface DocPropertyHolder
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to read.
      supplier - the supplier for the default value to return if the property value is null.
      Returns:
      the value of the property or the given default value.
    • readPropertyOrThrow

      @NonNull default <E> E readPropertyOrThrow(@NonNull @NonNull DocProperty<E> property)
      Reads the given property from the underlying document or throws a NoSuchElementException if the value is not set or set to null.
      Specified by:
      readPropertyOrThrow in interface DocPropertyHolder
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to read.
      Returns:
      the value of the property.
    • readPropertyOrThrow

      @NonNull default <E, T extends Throwable> E readPropertyOrThrow(@NonNull @NonNull DocProperty<E> property, @NonNull @NonNull Supplier<? extends T> exceptionSupplier) throws T
      Reads the given property from the underlying document or throws the exception that is computed by the given exception supplier if the value is not set or set to null.
      Specified by:
      readPropertyOrThrow in interface DocPropertyHolder
      Type Parameters:
      E - the type which gets read/written by the given property.
      T - the type of exception to throw in case the property has no value set.
      Parameters:
      property - the property to read.
      exceptionSupplier - the supplier that produces the exception to throw in case the property has no value set.
      Returns:
      the value of the property.
      Throws:
      T - if the property is not set or set to null.
    • propertyPresent

      default <E> boolean propertyPresent(@NonNull @NonNull DocProperty<E> property)
      Get if a value is associated with the given property. Values that are null are included as present.
      Specified by:
      propertyPresent in interface DocPropertyHolder
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to check for.
      Returns:
      true if a value is associated with the property, false otherwise.
    • propertyAbsent

      default <E> boolean propertyAbsent(@NonNull @NonNull DocProperty<E> property)
      Get if no value is associated with the given property. Values that are null are included as present.
      Specified by:
      propertyAbsent in interface DocPropertyHolder
      Type Parameters:
      E - the type which gets read/written by the given property.
      Parameters:
      property - the property to check for.
      Returns:
      true if no value is associated with the property, false otherwise.