T
- type which this subjective is handlingpublic interface Subjective<T>
Subject
from an object.
This is used to override standard Java object behavior, especially for
Object.equals(Object)
and Object.hashCode()
.Modifier and Type | Method and Description |
---|---|
default T |
cast(java.lang.Object object)
Cast any object to the type of this subjective.
|
Subject<T> |
subject(T object)
Get the substitute object for the given object.
|
default Subject<T> |
subjectFrom(java.lang.Object object)
Helper method to create a subject from an arbitrary object.
|
java.lang.Class<T> |
type()
Get the subjective type.
|
@NotNull java.lang.Class<T> type()
@NotNull default T cast(@NotNull java.lang.Object object)
object
- object to be castjava.lang.ClassCastException
- if object has wrong type@NotNull Subject<T> subject(@NotNull T object)
object
as immutable, i.e. to never change it.object
- object to be substituted@NotNull default Subject<T> subjectFrom(@NotNull java.lang.Object object)
object
- object expected to be of the type() of this subjectiveobject
java.lang.ClassCastException
- if object has wrong type