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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceDocPropertyHolder.Mutable<S extends DocPropertyHolder.Mutable<S>>A mutable version of a doc property holder which allows modifications to it. -
Method Summary
Modifier and TypeMethodDescription<E> booleanpropertyAbsent(@NonNull DocProperty<E> property) Get if no value is associated with the given property.Get the underlying document that all read and write operations are delegated to.<E> booleanpropertyPresent(@NonNull DocProperty<E> property) Get if a value is associated with the given property.<E> @UnknownNullability EreadProperty(@NonNull DocProperty<E> property) Reads the value of the given property from the underlying document.<E> @UnknownNullability EreadPropertyOrDefault(@NonNull DocProperty<E> property, E def) Reads the given property from the underlying document or returns the given default value if the property is not set or set tonull.<E> @UnknownNullability EreadPropertyOrGet(@NonNull DocProperty<E> property, @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 tonull.<E> EreadPropertyOrThrow(@NonNull DocProperty<E> property) Reads the given property from the underlying document or throws aNoSuchElementExceptionif the value is not set or set tonull.<E, T extends Throwable>
EreadPropertyOrThrow(@NonNull DocProperty<E> property, @NonNull Supplier<? extends T> exceptionSupplier) 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 tonull.
-
Method Details
-
readProperty
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 tonull.- 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 tonull.- 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
Reads the given property from the underlying document or throws aNoSuchElementExceptionif the value is not set or set tonull.- 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 tonull.- 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
Get if a value is associated with the given property. Values that arenullare 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
Get if no value is associated with the given property. Values that arenullare 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
-