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> Serializable,Function<T,T>
private static final class Converter.IdentityConverter<T>
extends Converter<T,T>
implements Serializable
A converter that always converts or reverses an object to itself. Note that T is now a
"pass-through type".
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Converter.IdentityConverter<?>private static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionPackage-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 TReturns a representation ofaas an instance of typeB.private Objectreverse()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, correctedDoBackward, correctedDoForward, equals, from, identity
-
Field Details
-
INSTANCE
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
IdentityConverter
private IdentityConverter()
-
-
Method Details
-
doForward
Description copied from class:ConverterReturns a representation ofaas an instance of typeB. Ifacannot be converted, an unchecked exception (such asIllegalArgumentException) should be thrown. -
doBackward
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
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
Description copied from class:ConverterPackage-private non-final implementation of andThen() so only we can override it. -
toString
-
readResolve
-