@UnstableApi public final class TypeSignature extends Object
"{type name}""i64""double""string""{type name}<{element type signature}[, {element type signature}]*>""list<i32>""repeated<set<string>>""map<string, com.example.FooStruct>""tuple<i8, string, double>""{fully qualified type name}""com.example.FooStruct""?{type name}""?BarStruct""?com.example.BarStruct"| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isBase()
Returns
true if this type signature represents a base type. |
boolean |
isContainer()
Returns
true if this type signature represents a container type. |
boolean |
isNamed()
Returns
true if this type signature represents a named type. |
boolean |
isUnresolved()
Returns
true if this type signature represents an unresolved type. |
String |
name()
Returns the name of the type.
|
Object |
namedTypeDescriptor()
Returns the descriptor of the type if and only if this type signature represents a named type.
|
static TypeSignature |
ofBase(String baseTypeName)
Creates a new type signature for a base type.
|
static TypeSignature |
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 TypeSignature |
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 TypeSignature |
ofList(Class<?> namedElementType)
Creates a new type signature for the list with the specified named element type.
|
static TypeSignature |
ofList(TypeSignature elementTypeSignature)
Creates a new type signature for the list with the specified element type signature.
|
static TypeSignature |
ofMap(Class<?> namedKeyType,
Class<?> namedValueType)
Creates a new type signature for the map with the specified named key and value types.
|
static TypeSignature |
ofMap(TypeSignature keyTypeSignature,
TypeSignature valueTypeSignature)
Creates a new type signature for the map with the specified key and value type signatures.
|
static TypeSignature |
ofNamed(Class<?> namedType)
Creates a new named type signature for the specified type.
|
static TypeSignature |
ofNamed(String name,
Object namedTypeDescriptor)
Creates a new named type signature for the provided name and arbitrary descriptor.
|
static TypeSignature |
ofSet(Class<?> namedElementType)
Creates a new type signature for the set with the specified named element type.
|
static TypeSignature |
ofSet(TypeSignature elementTypeSignature)
Creates a new type signature for the set with the specified element type signature.
|
static TypeSignature |
ofUnresolved(String unresolvedTypeName)
Creates a new unresolved type signature with the specified type name.
|
String |
signature()
Returns the
String representation of this type signature, as described in the class
documentation. |
String |
toString() |
List<TypeSignature> |
typeParameters()
Returns the list of the type parameters of this type signature.
|
public static TypeSignature ofBase(String baseTypeName)
IllegalArgumentException - if the specified type name is not validpublic static TypeSignature ofContainer(String containerTypeName, TypeSignature... elementTypeSignatures)
IllegalArgumentException - if the specified type name is not valid or
elementTypeSignatures is empty.public static TypeSignature ofContainer(String containerTypeName, Iterable<TypeSignature> elementTypeSignatures)
IllegalArgumentException - if the specified type name is not valid or
elementTypeSignatures is empty.public static TypeSignature ofList(TypeSignature elementTypeSignature)
ofContainer("list", elementTypeSignature);
public static TypeSignature ofList(Class<?> namedElementType)
ofList(ofNamed(namedElementType));
public static TypeSignature ofSet(TypeSignature elementTypeSignature)
ofContainer("set", elementTypeSignature);
public static TypeSignature ofSet(Class<?> namedElementType)
ofSet(ofNamed(namedElementType));
public static TypeSignature ofMap(TypeSignature keyTypeSignature, TypeSignature valueTypeSignature)
ofMap("map", keyTypeSignature, valueTypeSignature);
public static TypeSignature ofMap(Class<?> namedKeyType, Class<?> namedValueType)
ofMap(ofNamed(namedKeyType), ofNamed(namedValueType));
public static TypeSignature ofNamed(Class<?> namedType)
public static TypeSignature ofNamed(String name, Object namedTypeDescriptor)
public static TypeSignature ofUnresolved(String unresolvedTypeName)
public String name()
public Object namedTypeDescriptor()
DocServicePlugins, this will probably be a Class, but
other plugins may use an actual instance with descriptor information.public List<TypeSignature> typeParameters()
public String signature()
String representation of this type signature, as described in the class
documentation.public boolean isBase()
true if this type signature represents a base type.public boolean isContainer()
true if this type signature represents a container type.public boolean isNamed()
true if this type signature represents a named type.public boolean isUnresolved()
true if this type signature represents an unresolved type.Copyright © 2020 LeanCloud. All rights reserved.