public class Field extends ProtoElement
| Modifier and Type | Field and Description |
|---|---|
static com.google.common.base.Predicate<Field> |
HAS_MESSAGE_TYPE
Determines whether field has message type.
|
static com.google.common.base.Predicate<Field> |
IS_CYCLIC
Determines whether field is cyclic.
|
static com.google.common.base.Predicate<Field> |
IS_MAP
Determines whether field is a map.
|
static com.google.common.base.Predicate<Field> |
IS_ONEOF_SCOPED
Determines whether field is part of a oneof.
|
static com.google.common.base.Predicate<Field> |
IS_REPEATED
Determines whether field is repeated.
|
static int |
WIRETYPE_END_GROUP |
static int |
WIRETYPE_FIXED32 |
static int |
WIRETYPE_FIXED64 |
static int |
WIRETYPE_LENGTH_DELIMITED |
static int |
WIRETYPE_START_GROUP |
static int |
WIRETYPE_VARINT |
| Modifier and Type | Method and Description |
|---|---|
static Field |
create(MessageType parent,
com.google.protobuf.DescriptorProtos.FieldDescriptorProto proto,
java.lang.String path,
Oneof oneof)
Creates a field backed up by the given proto.
|
static Field |
createAsExtension(MessageType parent,
ExtensionPool.Extension extension,
java.lang.String path,
java.lang.String name)
Creates a field that represents an extension.
|
java.lang.String |
getDefaultValue()
Returns the default value of the field, as specified in the descriptor.proto,
or null if none is defined.
|
java.lang.String |
getJsonName()
Returns the JSON name of the field.
|
int |
getNumber()
Returns the field number.
|
Oneof |
getOneof()
Returns a oneof associated with this field, or null if none.
|
com.google.protobuf.DescriptorProtos.FieldDescriptorProto |
getProto()
Returns the underlying proto representation.
|
int |
getTag()
Returns the field tag.
|
TypeRef |
getType()
Returns the resolved type
|
int |
getWireType()
Returns the wired type encoding for the field.
|
boolean |
isDeprecated()
Returns true if this object represents something that is configured as deprecated.
|
boolean |
isOptional()
Returns true if the field is optional.
|
boolean |
isPacked()
Returns true if the field is packed.
|
boolean |
isRepeated()
Returns true if the field is repeated.
|
boolean |
isRequired()
Returns true if the field is required (proto2).
|
boolean |
oneofScoped()
Returns true if field is oneof-scoped.
|
void |
setOneof(Oneof oneof)
For setting the oneof.
|
void |
setType(TypeRef type)
For setting the resolved type.
|
java.lang.String |
toString() |
getFile, getFullName, getLocation, getModel, getParent, getSimpleName, getSyntax, isReachableaddAttribute, getAttribute, getAttributeOrDefault, hasAttribute, putAttribute, removeAttributepublic static final int WIRETYPE_VARINT
public static final int WIRETYPE_FIXED64
public static final int WIRETYPE_LENGTH_DELIMITED
public static final int WIRETYPE_START_GROUP
public static final int WIRETYPE_END_GROUP
public static final int WIRETYPE_FIXED32
public static final com.google.common.base.Predicate<Field> HAS_MESSAGE_TYPE
public static final com.google.common.base.Predicate<Field> IS_CYCLIC
public static final com.google.common.base.Predicate<Field> IS_REPEATED
public static final com.google.common.base.Predicate<Field> IS_ONEOF_SCOPED
public static final com.google.common.base.Predicate<Field> IS_MAP
public static Field create(MessageType parent, com.google.protobuf.DescriptorProtos.FieldDescriptorProto proto, java.lang.String path, @Nullable Oneof oneof)
public static Field createAsExtension(MessageType parent, ExtensionPool.Extension extension, java.lang.String path, java.lang.String name)
public com.google.protobuf.DescriptorProtos.FieldDescriptorProto getProto()
public boolean oneofScoped()
@Nullable public Oneof getOneof()
public void setOneof(@Nullable
Oneof oneof)
public boolean isOptional()
public boolean isRepeated()
public boolean isRequired()
public boolean isDeprecated()
isDeprecated in class ProtoElementpublic int getNumber()
public boolean isPacked()
public java.lang.String getJsonName()
public int getWireType()
public int getTag()
@Nullable public java.lang.String getDefaultValue()
public TypeRef getType()
public void setType(TypeRef type)
public java.lang.String toString()
toString in class java.lang.Object