Package com.google.common.base
Class Equivalence.Wrapper<T>
- java.lang.Object
-
- com.google.common.base.Equivalence.Wrapper<T>
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- Equivalence<T>
@Deprecated(since="2022-12-01") public static final class Equivalence.Wrapper<T> extends java.lang.Object implements java.io.Serializable
Deprecated.The Google Guava Core Libraries are deprecated and will not be part of the AEM SDK after April 2023Wraps an object so thatequals(Object)
andhashCode()
delegate to anEquivalence
.For example, given an
Equivalence
forstrings
namedequiv
that tests equivalence using their lengths:equiv.wrap("a").equals(equiv.wrap("b")) // true equiv.wrap("a").equals(equiv.wrap("hello")) // false
Note in particular that an equivalence wrapper is never equal to the object it wraps.
equiv.wrap(obj).equals(obj) // always false
- Since:
- 10.0
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Deprecated.Returnstrue
ifEquivalence.equivalent(Object, Object)
applied to the wrapped references istrue
and both wrappers use thesame
equivalence.T
get()
Deprecated.Returns the (possibly null) reference wrapped by this instance.int
hashCode()
Deprecated.Returns the result ofEquivalence.hash(Object)
applied to the wrapped reference.java.lang.String
toString()
Deprecated.Returns a string representation for this equivalence wrapper.
-
-
-
Method Detail
-
get
@Nullable public T get()
Deprecated.Returns the (possibly null) reference wrapped by this instance.
-
equals
public boolean equals(@Nullable java.lang.Object obj)
Deprecated.Returnstrue
ifEquivalence.equivalent(Object, Object)
applied to the wrapped references istrue
and both wrappers use thesame
equivalence.- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Deprecated.Returns the result ofEquivalence.hash(Object)
applied to the wrapped reference.- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Deprecated.Returns a string representation for this equivalence wrapper. The form of this string representation is not specified.- Overrides:
toString
in classjava.lang.Object
-
-