Package com.linecorp.armeria.common
Class Scheme
- java.lang.Object
-
- com.linecorp.armeria.common.Scheme
-
- All Implemented Interfaces:
Comparable<Scheme>
public final class Scheme extends Object implements Comparable<Scheme>
A pair ofSerializationFormat
andSessionProtocol
.A
Scheme
is represented and used as the scheme of a URI in the following format:SerializationFormat.uriText() + '+' + SessionProtocol.uriText()
For example:
"tbinary+https"
"tcompact+h2c"
"none+http"
-
-
Method Summary
Modifier and Type Method Description int
compareTo(Scheme o)
boolean
equals(Object obj)
int
hashCode()
static Scheme
of(SerializationFormat serializationFormat, SessionProtocol sessionProtocol)
static Scheme
parse(String scheme)
SerializationFormat
serializationFormat()
Returns theSerializationFormat
.SessionProtocol
sessionProtocol()
Returns theSessionProtocol
.String
toString()
static Optional<Scheme>
tryParse(String scheme)
String
uriText()
Returns the textual representation ("serializationFormat+sessionProtocol"
).
-
-
-
Method Detail
-
tryParse
public static Optional<Scheme> tryParse(@Nullable String scheme)
Parses the specifiedString
into aScheme
. This method will return the sameScheme
instance for equal values ofscheme
.- Returns:
Optional.empty()
if the specifiedString
could not be parsed or there is no suchScheme
available
-
parse
public static Scheme parse(String scheme)
Parses the specifiedString
into aScheme
. This method will return the sameScheme
instance for equal values ofscheme
.- Throws:
IllegalArgumentException
- if the specifiedString
could not be parsed or there is no suchScheme
available
-
of
public static Scheme of(SerializationFormat serializationFormat, SessionProtocol sessionProtocol)
Returns theScheme
of the specifiedSerializationFormat
andSessionProtocol
. This method returns the sameScheme
instance for the same combination ofSerializationFormat
andSessionProtocol
.
-
serializationFormat
public SerializationFormat serializationFormat()
Returns theSerializationFormat
.
-
sessionProtocol
public SessionProtocol sessionProtocol()
Returns theSessionProtocol
.
-
uriText
public String uriText()
Returns the textual representation ("serializationFormat+sessionProtocol"
).
-
compareTo
public int compareTo(Scheme o)
- Specified by:
compareTo
in interfaceComparable<Scheme>
-
-