Class DefaultFunctionalServiceProperty<T>
- java.lang.Object
-
- de.dytanic.cloudnet.driver.service.property.DefaultFunctionalServiceProperty<T>
-
- All Implemented Interfaces:
ServiceProperty<T>
public class DefaultFunctionalServiceProperty<T> extends java.lang.Object implements ServiceProperty<T>
-
-
Constructor Summary
Constructors Constructor Description DefaultFunctionalServiceProperty()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> DefaultFunctionalServiceProperty<T>create()@NotNull java.util.Optional<T>get(@NotNull ServiceInfoSnapshot serviceInfoSnapshot)Gets a property out of the properties of the givenServiceInfoSnapshot.DefaultFunctionalServiceProperty<T>get(java.util.function.Function<ServiceInfoSnapshot,T> getFunction)voidset(@NotNull ServiceInfoSnapshot serviceInfoSnapshot, T value)Sets a property into the properties of the givenServiceInfoSnapshot.DefaultFunctionalServiceProperty<T>set(java.util.function.BiConsumer<ServiceInfoSnapshot,T> setConsumer)
-
-
-
Method Detail
-
create
public static <T> DefaultFunctionalServiceProperty<T> create()
-
get
public DefaultFunctionalServiceProperty<T> get(java.util.function.Function<ServiceInfoSnapshot,T> getFunction)
-
set
public DefaultFunctionalServiceProperty<T> set(java.util.function.BiConsumer<ServiceInfoSnapshot,T> setConsumer)
-
get
@NotNull public @NotNull java.util.Optional<T> get(@NotNull @NotNull ServiceInfoSnapshot serviceInfoSnapshot)
Description copied from interface:ServicePropertyGets a property out of the properties of the givenServiceInfoSnapshot.- Specified by:
getin interfaceServiceProperty<T>- Parameters:
serviceInfoSnapshot- the serviceInfoSnapshot to get the property- Returns:
- an optional with the value, might be empty
-
set
public void set(@NotNull @NotNull ServiceInfoSnapshot serviceInfoSnapshot, @Nullable T value)Description copied from interface:ServicePropertySets a property into the properties of the givenServiceInfoSnapshot. Some properties might not support this. An update of the service might be necessary.- Specified by:
setin interfaceServiceProperty<T>- Parameters:
serviceInfoSnapshot- the serviceInfoSnapshot to modify the property invalue- the value to set or null to remove the property
-
-