org.springframework.data.mapping

## Class Alias

- java.lang.Object
- - org.springframework.data.mapping.Alias

    public final class Alias
    extends Object

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

Fields
`static Alias` `NONE` Common instance for `empty()`.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static Alias` `empty()` Returns an empty `Alias` instance.
`boolean` `equals(Object o)`
`Object` `getValue()`
`int` `hashCode()`
`boolean` `hasSamePresentValueAs(Alias other)` Returns whether the the current alias is present and has the same value as the given `Alias`.
`boolean` `hasValue(Object that)` Checks whether this `Alias` contains the value `that`.
`boolean` `isPresent()`
`boolean` `isPresentButDifferent(Alias other)` Checks whether this `Alias` has a value but is different from the `other` value.
`<T> T` `mapTyped(Class<T> type)` Return the value typed to `type` if the value is present and assignable to `type`.
`static Alias` `of(Object alias)` Create an `Alias` given the `alias` object.
`static Alias` `ofNullable(Object alias)` Create an `Alias` from a possibly present `alias` object.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### NONE

    public static final Alias NONE

Common instance for `empty()`.

### Method Detail

#### of

    public static Alias of(Object alias)

Create an `Alias` given the `alias` object.

Parameters:
  `alias` - must not be null.
Returns:
  the `Alias` for `alias`.

#### ofNullable

    public static Alias ofNullable(@Nullable
                                   Object alias)

Create an `Alias` from a possibly present `alias` object. Using a null alias will return `empty()`.

Parameters:
  `alias` - may be null.
Returns:
  the `Alias` for `alias` or `empty()` if the given alias was null.

#### empty

    public static Alias empty()

Returns an empty `Alias` instance. No value is present for this Alias.

Returns:
  an empty `Alias`.

#### isPresentButDifferent

    public boolean isPresentButDifferent(Alias other)

Checks whether this `Alias` has a value but is different from the `other` value.

Parameters:
  `other` - must not be null.
Returns:
  true if this value is present but different from the `other` value.

#### hasValue

    public boolean hasValue(Object that)

Checks whether this `Alias` contains the value `that`.

Parameters:
  `that` - the other value, may be null.
Returns:
  true if this alias has a value and it equals to `that`.

#### hasSamePresentValueAs

    public boolean hasSamePresentValueAs(Alias other)

Returns whether the the current alias is present and has the same value as the given `Alias`.

Parameters:
  `other` - the other `Alias`
Returns:
  true if there's an alias value present and its equal to the one in the given `Alias`.

#### isPresent

    public boolean isPresent()

Returns:
  true if this `Alias` contains a value.

#### mapTyped

    @Nullable
    public <T> T mapTyped(Class<T> type)

Return the value typed to `type` if the value is present and assignable to `type`.

Parameters:
  `type` - must not be null.
Returns:

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### getValue

    public Object getValue()

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`