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
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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn implementation of a mutable doc property holder that defaults all method calls to the underlying document that is returned by theDocPropertyHolder.propertyHolder()method. -
Method Summary
Modifier and TypeMethodDescriptiondefault <E> booleanpropertyAbsent(@NonNull DocProperty<E> property) Get if no value is associated with the given property.default <E> booleanpropertyPresent(@NonNull DocProperty<E> property) Get if a value is associated with the given property.default <E> @UnknownNullability EreadProperty(@NonNull DocProperty<E> property) Reads the value of the given property from the underlying document.default <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.default <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.default <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.default <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.Methods inherited from interface DocPropertyHolder
propertyHolder
-
Method Details
-
readProperty
Reads the value of the given property from the underlying document.- Specified by:
readPropertyin interfaceDocPropertyHolder- 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 tonull.- Specified by:
readPropertyOrDefaultin interfaceDocPropertyHolder- 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 tonull.- Specified by:
readPropertyOrGetin interfaceDocPropertyHolder- 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
Reads the given property from the underlying document or throws aNoSuchElementExceptionif the value is not set or set tonull.- Specified by:
readPropertyOrThrowin interfaceDocPropertyHolder- 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 tonull.- Specified by:
readPropertyOrThrowin interfaceDocPropertyHolder- 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
Get if a value is associated with the given property. Values that arenullare included as present.- Specified by:
propertyPresentin interfaceDocPropertyHolder- 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
Get if no value is associated with the given property. Values that arenullare included as present.- Specified by:
propertyAbsentin interfaceDocPropertyHolder- 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.
-