public class TypeRef
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
TypeRef.Cardinality
Represents cardinality of a type.
|
static class |
TypeRef.WellKnownType
Represents an enumeration of well-known types.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static TypeRef |
fromPrimitiveName(java.lang.String name)
Creates a reference to a primitive type based on its name in the protocol buffer language,
with default cardinality optional.
|
TypeRef.Cardinality |
getCardinality()
Returns the type cardinality.
|
EnumType |
getEnumType()
If this is a enum type, returns the enum, otherwise fails.
|
com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type |
getKind()
Returns the type kind.
|
Location |
getLocation()
If this is a message or enum type, return its declaration location, otherwise
SimpleLocation.UNKNOWN.
|
Field |
getMapKeyField()
Returns the field for the key of a map type.
|
Field |
getMapValueField()
Returns the field for a value of a map type.
|
MessageType |
getMessageType()
If this is a message type, returns the message, otherwise fails.
|
java.lang.String |
getPrimitiveTypeName()
If this is a primitive type, returns the proto type name, otherwise fails.
|
TypeRef.WellKnownType |
getWellKnownType()
Returns the well-known type kind, or NONE if its not one.
|
int |
hashCode() |
boolean |
isCyclic()
Return true of this is a cyclic message type.
|
boolean |
isEnum()
Returns true of this is an enum type.
|
boolean |
isMap()
Return trues if this type represents a map.
|
boolean |
isMessage()
Returns true of this is a message type.
|
boolean |
isPrimitive()
Returns true if this is a primitive type.
|
boolean |
isRepeated()
Returns true of the field is repeated.
|
TypeRef |
makeOptional()
Makes the given type to have cardinality optional.
|
TypeRef |
makeRepeated()
Makes the given type to have cardinality repeated.
|
TypeRef |
makeRequired()
Makes the given type to have cardinality required.
|
static TypeRef |
of(com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type primitiveType)
Creates a reference to a primitive type, with default cardinality optional.
|
static TypeRef |
of(EnumType enumType)
Creates a reference to an enum type, with default cardinality optional.
|
static TypeRef |
of(MessageType messageType)
Creates a reference to a message type, with default cardinality optional.
|
java.lang.String |
toString() |
public static TypeRef of(com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type primitiveType)
public static TypeRef of(MessageType messageType)
public static TypeRef of(EnumType enumType)
@Nullable public static TypeRef fromPrimitiveName(java.lang.String name)
public com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Type getKind()
public TypeRef.Cardinality getCardinality()
public boolean isRepeated()
public boolean isMap()
public Field getMapKeyField()
public Field getMapValueField()
public TypeRef.WellKnownType getWellKnownType()
public TypeRef makeOptional()
public TypeRef makeRequired()
public TypeRef makeRepeated()
public MessageType getMessageType()
public EnumType getEnumType()
public java.lang.String getPrimitiveTypeName()
public boolean isCyclic()
public Location getLocation()
public boolean isMessage()
public boolean isEnum()
public boolean isPrimitive()
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object