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

pack-priv final Class StringToEnumConverterFactory

extends Object
implements ConverterFactory<String, Enum<E extends Enum<E>>>
Class Inheritance
All Implemented Interfaces
org.springframework.core.convert.converter.ConverterFactory
Annotations
@SuppressWarnings:rawtypes, unchecked
Imports
org.springframework.core.convert.converter.Converter, .ConverterFactory, org.springframework.lang.Nullable

Converts from a String to a java.lang.Enum by calling Enum#valueOf(Class, String).
Authors
Keith Donald, Stephane Nicoll
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public <T extends Enum<E extends Enum<E>>> Converter<String, T>
getConverter(Class<T>
the target type to convert to
targetType
)

Implements org.springframework.core.convert.converter.ConverterFactory.getConverter.

Get the converter to convert from S to target type T, where T is also an instance of R.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StringToEnumConverterFactoryback to summary
pack-priv StringToEnumConverterFactory()

Method Detail

getConverterback to summary
public <T extends Enum<E extends Enum<E>>> Converter<String, T> getConverter(Class<T> targetType)

Implements org.springframework.core.convert.converter.ConverterFactory.getConverter.

Doc from org.springframework.core.convert.converter.ConverterFactory.getConverter.

Get the converter to convert from S to target type T, where T is also an instance of R.

Parameters
<T>
the target type
targetType:Class<T>

the target type to convert to

Returns:Converter<String, T>

a converter from S to T

Annotations
@Override
org.springframework.core.convert.support back to summary

private Class StringToEnumConverterFactory.StringToEnum<T extends Enum<E extends Enum<E>>>

extends Object
implements Converter<String, T extends Enum<E extends Enum<E>>>
Class Inheritance
  • java.lang.Object
  • org.springframework.core.convert.support.StringToEnumConverterFactory.StringToEnum
All Implemented Interfaces
org.springframework.core.convert.converter.Converter

Field Summary

Modifier and TypeField and Description
private final Class<T>

Constructor Summary

AccessConstructor and Description
pack-priv
StringToEnum(Class<T> enumType)

Method Summary

Modifier and TypeMethod and Description
public T
convert(String
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 java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

enumTypeback to summary
private final Class<T> enumType

Constructor Detail

StringToEnumback to summary
pack-priv StringToEnum(Class<T> enumType)

Method Detail

convertback to summary
public T convert(String 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:String

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

Returns:T

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

Annotations
@Override
@Nullable