Interface DocPropertyHolder

All Known Subinterfaces:
DefaultedDocPropertyHolder, DefaultedDocPropertyHolder.Mutable<S>, DefaultedDocPropertyHolder.Mutable.WithDirectModifier<S>, DocPropertyHolder.Mutable<S>, Document, Document.Mutable
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 DocPropertyHolder
A holder for doc properties that supports various read and write operations to the underlying document.
Since:
4.0
  • Method Details

    • readProperty

      <E> @UnknownNullability E readProperty(@NonNull @NonNull DocProperty<E> property)
      Reads the value of the given property from the underlying document.
      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.
      Throws:
      NullPointerException - if the given property is null.
    • readPropertyOrDefault

      <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.
      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.
      Throws:
      NullPointerException - if the given property is null.
    • readPropertyOrGet

      <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.
      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.
      Throws:
      NullPointerException - if the given property or default supplier is null.
    • readPropertyOrThrow

      @NonNull <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.
      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.
      Throws:
      NullPointerException - if the given property is null.
      NoSuchElementException - if the property is not set or set to null.
    • readPropertyOrThrow

      @NonNull <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.
      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:
      NullPointerException - if the given property or exception supplier is null.
      T - if the property is not set or set to null.
    • propertyPresent

      <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.
      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.
      Throws:
      NullPointerException - if the given property is null.
    • propertyAbsent

      <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.
      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.
      Throws:
      NullPointerException - if the given property is null.
    • propertyHolder

      @NonNull @NonNull Document propertyHolder()
      Get the underlying document that all read and write operations are delegated to.
      Returns:
      the underlying document.