Package com.linecorp.armeria.server.docs
Interface TypeSignature
- All Known Implementing Classes:
ContainerTypeSignature
,DescriptiveTypeSignature
,MapTypeSignature
Type signature of a method parameter, a method return value or a struct/exception field.
A type signature can be represented as a string in one of the following forms:
- Base types:
"{type name}"
"i64"
"double"
"string"
- Container types:
"{type name}<{element type signature}[, {element type signature}]*>"
"list<i32>"
"repeated<set<string>>"
"map<string, com.example.FooStruct>"
"tuple<i8, string, double>"
- Named types (enums, structs and exceptions):
"{fully qualified type name}"
"com.example.FooStruct"
- Unresolved types:
"?{type name}"
"?BarStruct"
"?com.example.BarStruct"
-
Method Summary
Modifier and TypeMethodDescriptionname()
Returns the name of the type.static TypeSignature
Creates a new type signature for a base type.static ContainerTypeSignature
ofContainer
(String containerTypeName, TypeSignature... elementTypeSignatures) Creates a new container type with the specified container type name and the type signatures of the elements it contains.static ContainerTypeSignature
ofContainer
(String containerTypeName, Iterable<TypeSignature> elementTypeSignatures) Creates a new container type with the specified container type name and the type signatures of the elements it contains.static DescriptiveTypeSignature
Creates a new enum type signature for the specified type.static DescriptiveTypeSignature
Creates a new enum type signature for the provided name and arbitrary descriptor.static ContainerTypeSignature
ofIterable
(String iterableTypeName, TypeSignature elementTypeSignature) Creates a new container type with the specified container type name and the type signatures of the elements it contains.static ContainerTypeSignature
ofList
(TypeSignature elementTypeSignature) Creates a new type signature for the list with the specified element type signature.static MapTypeSignature
ofMap
(TypeSignature keyTypeSignature, TypeSignature valueTypeSignature) Creates a new type signature for the map with the specified key and value type signatures.static ContainerTypeSignature
ofOptional
(TypeSignature elementTypeSignature) Creates a new type signature for the optional type with the specified element type signature.static ContainerTypeSignature
ofSet
(TypeSignature elementTypeSignature) Creates a new type signature for the set with the specified element type signature.static DescriptiveTypeSignature
Creates a new struct type signature for the specified type.static DescriptiveTypeSignature
Creates a new struct type signature for the provided name and arbitrary descriptor.static TypeSignature
ofUnresolved
(String unresolvedTypeName) Creates a new unresolved type signature with the specified type name.default String
Returns theString
representation of this type signature, as described in the class documentation.type()
Returns theTypeSignatureType
.
-
Method Details
-
ofBase
Creates a new type signature for a base type.- Throws:
IllegalArgumentException
- if the specified type name is not valid
-
ofContainer
static ContainerTypeSignature ofContainer(String containerTypeName, TypeSignature... elementTypeSignatures) Creates a new container type with the specified container type name and the type signatures of the elements it contains.- Throws:
IllegalArgumentException
- if the specified type name is not valid orelementTypeSignatures
is empty.
-
ofContainer
static ContainerTypeSignature ofContainer(String containerTypeName, Iterable<TypeSignature> elementTypeSignatures) Creates a new container type with the specified container type name and the type signatures of the elements it contains.- Throws:
IllegalArgumentException
- if the specified type name is not valid orelementTypeSignatures
is empty.
-
ofList
Creates a new type signature for the list with the specified element type signature. This method is a shortcut for:ofContainer("list", elementTypeSignature);
-
ofSet
Creates a new type signature for the set with the specified element type signature. This method is a shortcut for:ofContainer("set", elementTypeSignature);
-
ofIterable
static ContainerTypeSignature ofIterable(String iterableTypeName, TypeSignature elementTypeSignature) Creates a new container type with the specified container type name and the type signatures of the elements it contains.- Throws:
IllegalArgumentException
- if the specified type name is not valid orelementTypeSignatures
is empty.
-
ofMap
Creates a new type signature for the map with the specified key and value type signatures. This method is a shortcut for:ofMap("map", keyTypeSignature, valueTypeSignature);
-
ofOptional
Creates a new type signature for the optional type with the specified element type signature. -
ofStruct
Creates a new struct type signature for the specified type. AnException
type is also created using this method. -
ofStruct
Creates a new struct type signature for the provided name and arbitrary descriptor. AnException
type is also created using this method. -
ofEnum
Creates a new enum type signature for the specified type. -
ofEnum
Creates a new enum type signature for the provided name and arbitrary descriptor. -
ofUnresolved
Creates a new unresolved type signature with the specified type name. -
type
TypeSignatureType type()Returns theTypeSignatureType
. -
name
String name()Returns the name of the type. -
signature
Returns theString
representation of this type signature, as described in the class documentation.
-