Top Description Fields Constructors Methods
io.github.darvil.utils

public Class ModifyRecord<T>

extends Object
Class Inheritance
Type Parameters
<T>
The type of the inner value.
Imports
org.jetbrains.annotations.NotNull

Provides a way to see if the inner value has been modified since the constructor was called.

Field Summary

Modifier and TypeField and Description
private boolean
private T

Constructor Summary

AccessConstructor and Description
private
ModifyRecord(T value)

Method Summary

Modifier and TypeMethod and Description
public static <
The type of the value.
T
>
ModifyRecord<T>

Returns:

A new empty ModifyRecord.
empty
()

Creates a new empty ModifyRecord.

public T

Returns:

The value stored in the ModifyRecord.
get
()

Returns the value stored in the ModifyRecord.

public boolean

Returns:

true if the value has been modified.
isModified
()

Returns true if the value has been modified.

public static <
The type of the value.
T
>
ModifyRecord<T>

Returns:

A new ModifyRecord with the given value.
of
(T
The value to store.
value
)

Creates a new ModifyRecord with the given value.

public void
set(T
The value to set.
value
)

Sets the value to the specified value and marks this ModifyRecord as modified.

public void
set(@NotNull ModifyRecord<T>
The value to set.
value
)

Sets the value to the value provided by the specified ModifyRecord and marks this ModifyRecord as modified.

public void
setIfNotModified(T
The value to set.
value
)

Sets the value to the specified value if it has not been modified.

public void
setIfNotModified(@NotNull ModifyRecord<T>
The value to set.
value
)

Sets the value to the specified value if it has not been modified.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

modifiedback to summary
private boolean modified
valueback to summary
private T value

Constructor Detail

ModifyRecordback to summary
private ModifyRecord(T value)

Method Detail

emptyback to summary
public static <T> ModifyRecord<T> empty()

Creates a new empty ModifyRecord.

Parameters
<T>
The type of the value.
Returns:ModifyRecord<T>

A new empty ModifyRecord.

getback to summary
public T get()

Returns the value stored in the ModifyRecord.

Returns:T

The value stored in the ModifyRecord.

isModifiedback to summary
public boolean isModified()

Returns true if the value has been modified.

Returns:boolean

true if the value has been modified.

ofback to summary
public static <T> ModifyRecord<T> of(T value)

Creates a new ModifyRecord with the given value.

Parameters
<T>
The type of the value.
value:T

The value to store.

Returns:ModifyRecord<T>

A new ModifyRecord with the given value.

setback to summary
public void set(T value)

Sets the value to the specified value and marks this ModifyRecord as modified.

Parameters
value:T

The value to set.

setback to summary
public void set(@NotNull ModifyRecord<T> value)

Sets the value to the value provided by the specified ModifyRecord and marks this ModifyRecord as modified.

Parameters
value:@NotNull ModifyRecord<T>

The value to set.

setIfNotModifiedback to summary
public void setIfNotModified(T value)

Sets the value to the specified value if it has not been modified.

Parameters
value:T

The value to set.

setIfNotModifiedback to summary
public void setIfNotModified(@NotNull ModifyRecord<T> value)

Sets the value to the specified value if it has not been modified. The value is provided by the specified ModifyRecord.

Parameters
value:@NotNull ModifyRecord<T>

The value to set.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override