Package com.google.common.base
Class Converter.IdentityConverter<T>
- java.lang.Object
-
- com.google.common.base.Converter<T,T>
-
- com.google.common.base.Converter.IdentityConverter<T>
-
- All Implemented Interfaces:
Function<T,T>,java.io.Serializable,java.util.function.Function<T,T>
private static final class Converter.IdentityConverter<T> extends Converter<T,T> implements java.io.Serializable
A converter that always converts or reverses an object to itself. Note that T is now a "pass-through type".
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static Converter.IdentityConverterINSTANCEprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description privateIdentityConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) <S> Converter<T,S>doAndThen(Converter<T,S> otherConverter)Package-private non-final implementation of andThen() so only we can override it.protected TdoBackward(T t)Returns a representation ofbas an instance of typeA.protected TdoForward(T t)Returns a representation ofaas an instance of typeB.private java.lang.ObjectreadResolve()Converter.IdentityConverter<T>reverse()Returns the reversed view of this converter, which convertsthis.convert(a)back to a value roughly equivalent toa.java.lang.StringtoString()-
Methods inherited from class com.google.common.base.Converter
andThen, apply, convert, convertAll, correctedDoBackward, correctedDoForward, equals, from, identity
-
-
-
-
Field Detail
-
INSTANCE
static final Converter.IdentityConverter INSTANCE
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
doForward
protected T doForward(T t)
Description copied from class:ConverterReturns a representation ofaas an instance of typeB. Ifacannot be converted, an unchecked exception (such asIllegalArgumentException) should be thrown.
-
doBackward
protected T doBackward(T t)
Description copied from class:ConverterReturns a representation ofbas an instance of typeA. Ifbcannot be converted, an unchecked exception (such asIllegalArgumentException) should be thrown.- Specified by:
doBackwardin classConverter<T,T>- Parameters:
t- the instance to convert; will never be null- Returns:
- the converted instance; must not be null
-
reverse
public Converter.IdentityConverter<T> reverse()
Description copied from class:ConverterReturns the reversed view of this converter, which convertsthis.convert(a)back to a value roughly equivalent toa.The returned converter is serializable if
thisconverter is.Note: you should not override this method. It is non-final for legacy reasons.
-
doAndThen
<S> Converter<T,S> doAndThen(Converter<T,S> otherConverter)
Description copied from class:ConverterPackage-private non-final implementation of andThen() so only we can override it.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
readResolve
private java.lang.Object readResolve()
-
-