Top Description Constructors Methods
org.springframework.core.convert.support

pack-priv final Class EnumToIntegerConverter

extends AbstractConditionalEnumConverter
implements Converter<Enum<?>, Integer>
Class Inheritance
All Implemented Interfaces
org.springframework.core.convert.converter.Converter
Imports
org.springframework.core.convert.ConversionService, org.springframework.core.convert.converter.Converter

Calls Enum#ordinal() to convert a source Enum to an Integer. This converter will not match enums with interfaces that can be converted.
Author
Yanming Zhou
Since
4.3

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Integer
convert(Enum<?>
the source object to convert, which must be an instance of S (never null)
source
)

Implements org.springframework.core.convert.converter.Converter.convert.

Convert the source object of type S to target type T.

Inherited from org.springframework.core.convert.support.AbstractConditionalEnumConverter:
matches

Constructor Detail

EnumToIntegerConverterback to summary
public EnumToIntegerConverter(ConversionService conversionService)

Method Detail

convertback to summary
public Integer convert(Enum<?> source)

Implements org.springframework.core.convert.converter.Converter.convert.

Doc from org.springframework.core.convert.converter.Converter.convert.

Convert the source object of type S to target type T.

Parameters
source:Enum<?>

the source object to convert, which must be an instance of S (never null)

Returns:Integer

the converted object, which must be an instance of T (potentially null)

Annotations
@Override