Class DefaultJsonServiceProperty<T>
- java.lang.Object
-
- de.dytanic.cloudnet.driver.service.property.DefaultJsonServiceProperty<T>
-
- All Implemented Interfaces:
ServiceProperty<T>
public class DefaultJsonServiceProperty<T> extends java.lang.Object implements ServiceProperty<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> @NotNull DefaultJsonServiceProperty<T>createFromClass(@NotNull java.lang.String key, @NotNull java.lang.Class<T> classType)static <T> @NotNull DefaultJsonServiceProperty<T>createFromType(@NotNull java.lang.String key, @NotNull java.lang.reflect.Type type)static <T> @NotNull DefaultJsonServiceProperty<T>createFromType(@NotNull java.lang.String key, @NotNull java.lang.reflect.Type type, boolean forbidModifications)DefaultJsonServiceProperty<T>forbidModification()@NotNull java.util.Optional<T>get(@NotNull ServiceInfoSnapshot serviceInfoSnapshot)Gets a property out of the properties of the givenServiceInfoSnapshot.voidset(@NotNull ServiceInfoSnapshot serviceInfoSnapshot, T value)Sets a property into the properties of the givenServiceInfoSnapshot.
-
-
-
Method Detail
-
createFromClass
@NotNull public static <T> @NotNull DefaultJsonServiceProperty<T> createFromClass(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.Class<T> classType)
-
createFromType
@NotNull public static <T> @NotNull DefaultJsonServiceProperty<T> createFromType(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.reflect.Type type)
-
createFromType
@NotNull public static <T> @NotNull DefaultJsonServiceProperty<T> createFromType(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.reflect.Type type, boolean forbidModifications)
-
forbidModification
public DefaultJsonServiceProperty<T> forbidModification()
-
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, 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
-
-