Package org.springframework.data.mapping
Class Alias
java.lang.Object
org.springframework.data.mapping.Alias
A container object which may or may not contain a type alias value. If a value is present,
isPresent()
will
return true
and getValue()
will return the value.
Additional methods that depend on the presence or absence of a contained value are provided, such as
hasValue(Object)
or isPresent()
Aliases are immutable once created.
- Author:
- Oliver Gierke, Christoph Strobl, Mark Paluch
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Alias
empty()
Returns an emptyAlias
instance.boolean
getValue()
int
hashCode()
boolean
hasSamePresentValueAs
(Alias other) Returns whether the the current alias is present and has the same value as the givenAlias
.boolean
Checks whether thisAlias
contains the valuethat
.boolean
boolean
isPresentButDifferent
(Alias other) Checks whether thisAlias
has a value but is different from theother
value.<T> T
Return the value typed totype
if the value is present and assignable totype
.static Alias
Create anAlias
given thealias
object.static Alias
ofNullable
(Object alias) Create anAlias
from a possibly presentalias
object.toString()
-
Field Details
-
NONE
Common instance forempty()
.
-
-
Method Details
-
of
Create anAlias
given thealias
object.- Parameters:
alias
- must not be null.- Returns:
- the
Alias
foralias
.
-
ofNullable
-
empty
Returns an emptyAlias
instance. No value is present for this Alias.- Returns:
- an empty
Alias
.
-
isPresentButDifferent
Checks whether thisAlias
has a value but is different from theother
value.- Parameters:
other
- must not be null.- Returns:
- true if this value is present but different from the
other
value.
-
hasValue
Checks whether thisAlias
contains the valuethat
.- Parameters:
that
- the other value, may be null.- Returns:
- true if this alias has a value and it equals to
that
.
-
hasSamePresentValueAs
Returns whether the the current alias is present and has the same value as the givenAlias
. -
isPresent
public boolean isPresent()- Returns:
- true if this
Alias
contains a value.
-
mapTyped
Return the value typed totype
if the value is present and assignable totype
.- Parameters:
type
- must not be null.- Returns:
-
toString
-
getValue
-
equals
-
hashCode
public int hashCode()
-