Package com.google.common.base
Class Converter.ReverseConverter<A,B>
- java.lang.Object
-
- com.google.common.base.Converter<B,A>
-
- com.google.common.base.Converter.ReverseConverter<A,B>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Converter<A,B>
original
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description ReverseConverter(Converter<A,B> original)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) B
correctedDoBackward(A a)
(package private) A
correctedDoForward(B b)
protected B
doBackward(A a)
Returns a representation ofb
as an instance of typeA
.protected A
doForward(B b)
Returns a representation ofa
as an instance of typeB
.boolean
equals(java.lang.Object object)
Indicates whether another object is equal to this converter.int
hashCode()
Converter<A,B>
reverse()
Returns the reversed view of this converter, which convertsthis.convert(a)
back to a value roughly equivalent toa
.java.lang.String
toString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
doForward
protected A doForward(B b)
Description copied from class:Converter
Returns a representation ofa
as an instance of typeB
. Ifa
cannot be converted, an unchecked exception (such asIllegalArgumentException
) should be thrown.
-
doBackward
protected B doBackward(A a)
Description copied from class:Converter
Returns a representation ofb
as an instance of typeA
. Ifb
cannot be converted, an unchecked exception (such asIllegalArgumentException
) should be thrown.- Specified by:
doBackward
in classConverter<B,A>
- Parameters:
a
- the instance to convert; will never be null- Returns:
- the converted instance; must not be null
-
correctedDoForward
@Nullable A correctedDoForward(@Nullable B b)
- Overrides:
correctedDoForward
in classConverter<B,A>
-
correctedDoBackward
@Nullable B correctedDoBackward(@Nullable A a)
- Overrides:
correctedDoBackward
in classConverter<B,A>
-
reverse
public Converter<A,B> reverse()
Description copied from class:Converter
Returns the reversed view of this converter, which convertsthis.convert(a)
back to a value roughly equivalent toa
.The returned converter is serializable if
this
converter is.
-
equals
public boolean equals(@Nullable java.lang.Object object)
Description copied from class:Converter
Indicates whether another object is equal to this converter.Most implementations will have no reason to override the behavior of
Object.equals(java.lang.Object)
. However, an implementation may also choose to returntrue
wheneverobject
is aConverter
that it considers interchangeable with this one. "Interchangeable" typically means thatObjects.equal(this.convert(a), that.convert(a))
is true for alla
of typeA
(and similarly forreverse
). Note that afalse
result from this method does not imply that the converters are known not to be interchangeable.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-