T - T type of object valuepublic final class MCreference<T>
extends java.lang.Object
MCreference is a class used as a container for other object value wich might be null or non-null.
If a value is present, isPresent() will return true and
get() will return the value.| Modifier and Type | Method and Description |
|---|---|
static <T> MCreference<T> |
empty()
Creates an instance of
MCreference with null object value |
boolean |
equals(java.lang.Object obj)
Checks if the object value of current
MCreference is equal to the object value of another MCreference object |
T |
get()
Get an object value
|
int |
hashCode()
Gets the hashcode of the object value
|
boolean |
isPresent()
Checks if the object value is non-null
|
static <T> MCreference<T> |
of(T value)
Creates an instance of
MCreference with non-null object value of T type |
static <T> MCreference<T> |
ofNullable(T value)
Returns an
MCreference with the specified non-null value if or an empty MCreference. |
void |
set(T value)
Sets an object value
|
java.lang.String |
toString()
Converts the object value to
String |
public static <T> MCreference<T> empty()
MCreference with null object valueT - Type of the object valueMCreference objectpublic static <T> MCreference<T> of(T value)
MCreference with non-null object value of T typeT - Type of the object valuevalue - Object valueMCreference objectpublic static <T> MCreference<T> ofNullable(T value)
MCreference with the specified non-null value if or an empty MCreference.T - Type of object valuevalue - Object valueMCreference with a non-null object value or an empty MCreferencepublic T get()
public void set(T value)
value - Object valuepublic boolean isPresent()
true if object value is non-nullpublic boolean equals(java.lang.Object obj)
MCreference is equal to the object value of another MCreference objectequals in class java.lang.Objectobj - Objecttrue if the object value of current MCreference is equal to the object value of another MCreference objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
StringtoString in class java.lang.ObjectString