java.lang.Object
io.github.darvil.utils.ModifyRecord<T>
- Type Parameters:
T- The type of the inner value.
Provides a way to see if the inner value has been modified since the constructor was called.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ModifyRecord<T>empty()Creates a new emptyModifyRecord.get()Returns the value stored in theModifyRecord.booleanReturnstrueif the value has been modified.static <T> ModifyRecord<T>of(T value) Creates a newModifyRecordwith the given value.voidset(@NotNull ModifyRecord<T> value) Sets the value to the value provided by the specifiedModifyRecordand marks thisModifyRecordas modified.voidSets the value to the specified value and marks thisModifyRecordas modified.voidsetIfNotModified(@NotNull ModifyRecord<T> value) Sets the value to the specified value if it has not been modified.voidsetIfNotModified(T value) Sets the value to the specified value if it has not been modified.toString()
-
Method Details
-
of
Creates a newModifyRecordwith the given value.- Type Parameters:
T- The type of the value.- Parameters:
value- The value to store.- Returns:
- A new
ModifyRecordwith the given value.
-
empty
Creates a new emptyModifyRecord.- Type Parameters:
T- The type of the value.- Returns:
- A new empty
ModifyRecord.
-
get
Returns the value stored in theModifyRecord.- Returns:
- The value stored in the
ModifyRecord.
-
set
Sets the value to the specified value and marks thisModifyRecordas modified.- Parameters:
value- The value to set.
-
set
Sets the value to the value provided by the specifiedModifyRecordand marks thisModifyRecordas modified.- Parameters:
value- The value to set.
-
setIfNotModified
Sets the value to the specified value if it has not been modified.- Parameters:
value- The value to set.
-
setIfNotModified
Sets the value to the specified value if it has not been modified. The value is provided by the specifiedModifyRecord.- Parameters:
value- The value to set.
-
isModified
public boolean isModified()Returnstrueif the value has been modified.- Returns:
trueif the value has been modified.
-
toString
-