Package io.micronaut.http.cookie
Class SameSiteConverter
java.lang.Object
io.micronaut.http.cookie.SameSiteConverter
- All Implemented Interfaces:
TypeConverter<CharSequence,
SameSite>
@Singleton
public class SameSiteConverter
extends Object
implements TypeConverter<CharSequence,SameSite>
Converts a string to a
SameSite
.- Since:
- 3.0.1
- Author:
- Sergio del Amo
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconvert
(CharSequence object, Class<SameSite> 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
-
SameSiteConverter
public SameSiteConverter()
-
-
Method Details
-
convert
public Optional<SameSite> convert(CharSequence object, Class<SameSite> 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<CharSequence,
SameSite> - Parameters:
object
- e.g. stricttargetType
- The target type being converted toSameSite
context
- TheConversionContext
- Returns:
SameSite
-