Interface ConverterSession
- All Known Implementing Classes:
BsonParserSession,BsonSerializerSession,CborParserSession,CborSerializerSession,CsvParserSession,CsvSerializerSession,HjsonParserSession,HjsonSerializerSession,HoconParserSession,HoconSerializerSession,HtmlDocSerializerSession,HtmlParserSession,HtmlSchemaDocSerializerSession,HtmlSchemaSerializerSession,HtmlSerializerSession,HtmlStrippedDocSerializerSession,IniParserSession,IniSerializerSession,InputStreamParserSession,JcsSerializerSession,Json5lParserSession,Json5lSerializerSession,Json5ParserSession,Json5SerializerSession,JsonlParserSession,JsonlSerializerSession,JsonParserSession,JsonSchemaGeneratorSession,JsonSchemaSerializerSession,JsonSerializerSession,MarkdownDocParserSession,MarkdownDocSerializerSession,MarkdownParserSession,MarkdownSerializerSession,MarshallingSession,MarshallingTraverseSession,MockRestRequest,MsgPackParserSession,MsgPackSerializerSession,OpenApiParserSession,OpenApiSerializerSession,OutputStreamSerializerSession,ParquetParserSession,ParquetSerializerSession,ParserSession,PlainTextParserSession,PlainTextSerializerSession,RdfParserSession,RdfSerializerSession,RdfStreamParserSession,RdfStreamSerializerSession,ReaderParserSession,RestRequest,SerializerSession,SoapXmlSerializerSession,SseParserSession,SseSerializerSession,TomlParserSession,TomlSerializerSession,UonParserSession,UonSerializerSession,UrlEncodingParserSession,UrlEncodingSerializerSession,WriterSerializerSession,XmlDocSerializerSession,XmlParserSession,XmlSerializerSession,YamlParserSession,YamlSerializerSession
Conversion functions at call time.
A ConverterSession is passed through the Conversion.to(Object, Object, ConverterSession, Class[])
method and allows conversion lambdas to retrieve session-scoped objects such as a TimeZone,
Locale, or media type without requiring those objects to be captured in the lambda closure.
Implementations look up contextual objects by type (and optionally by name). If no matching object is
registered for the requested type the method returns Optional.empty().
Example:
See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> Optional<T>Returns a contextual object of the specified type, orOptional.empty()if none is registered.default <T> Optional<T>Returns a named contextual object of the specified type, orOptional.empty()if none is registered.
-
Method Details
-
get
Returns a contextual object of the specified type, orOptional.empty()if none is registered.- Type Parameters:
T- The object type.- Parameters:
c- The object type to look up.- Returns:
- The contextual object wrapped in an
Optional, orOptional.empty()if not available.
-
get
Returns a named contextual object of the specified type, orOptional.empty()if none is registered.The default implementation ignores the name and delegates to
get(Class). Override this method when multiple objects of the same type need to be distinguished by name.- Type Parameters:
T- The object type.- Parameters:
name- The object name, ornull to match any.c- The object type to look up.- Returns:
- The contextual object wrapped in an
Optional, orOptional.empty()if not available.
-