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>
- All Implemented Interfaces:
Function<B,
,A> Serializable
,Function<B,
A>
private static final class Converter.ReverseConverter<A,B>
extends Converter<B,A>
implements Serializable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) B
(package private) A
protected B
doBackward
(A a) Returns a representation ofb
as an instance of typeA
.protected A
Returns a representation ofa
as an instance of typeB
.boolean
Indicates whether another object is equal to this converter.int
hashCode()
reverse()
Returns the reversed view of this converter, which convertsthis.convert(a)
back to a value roughly equivalent toa
.toString()
Methods inherited from class com.google.common.base.Converter
andThen, apply, convert, convertAll, doAndThen, from, identity
-
Field Details
-
original
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
ReverseConverter
-
-
Method Details
-
doForward
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
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
- Overrides:
correctedDoForward
in classConverter<B,
A>
-
correctedDoBackward
- Overrides:
correctedDoBackward
in classConverter<B,
A>
-
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.Note: you should not override this method. It is non-final for legacy reasons.
-
equals
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() -
toString
-