Package io.micronaut.http.server.cors
Class CorsOriginConverter
java.lang.Object
io.micronaut.http.server.cors.CorsOriginConverter
- All Implemented Interfaces:
TypeConverter<Map<String,
Object>, CorsOriginConfiguration>
@Singleton
public class CorsOriginConverter
extends Object
implements TypeConverter<Map<String,Object>,CorsOriginConfiguration>
Responsible for converting a map of configuration to an instance of
CorsOriginConfiguration
.- Since:
- 1.0
- Author:
- James Kleeh, Graeme Rocher
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvert
(Map<String, Object> object, Class<CorsOriginConfiguration> targetType, ConversionContext context) Converts from the given source object type to the target type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.convert.TypeConverter
convert
-
Constructor Details
-
CorsOriginConverter
public CorsOriginConverter()
-
-
Method Details
-
convert
public Optional<CorsOriginConfiguration> convert(Map<String, Object> object, Class<CorsOriginConfiguration> targetType, ConversionContext context) Description copied from interface:TypeConverter
Converts from the given source object type to the target type. Implementers should take care to returnOptional.empty()
in case the object is not convertible by catching any necessary exceptions and failing gracefully.- Specified by:
convert
in interfaceTypeConverter<Map<String,
Object>, CorsOriginConfiguration> - Parameters:
object
- The object typetargetType
- The target type being converted tocontext
- TheConversionContext
- Returns:
- The converted type or empty if the conversion is not possible
-