Package com.google.protobuf
Enum FieldType
- java.lang.Object
-
- java.lang.Enum<FieldType>
-
- com.google.protobuf.FieldType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<FieldType>
@ExperimentalApi public enum FieldType extends java.lang.Enum<FieldType>
Enumeration identifying all relevant type information for a protobuf field.
-
-
Enum Constant Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FieldType
forId(int id)
Looks up the appropriateFieldType
by it's identifier.JavaType
getJavaType()
Gets theJavaType
for this field.int
id()
A reliable unique identifier for this type.boolean
isList()
Indicates whether this field represents a list of values.boolean
isMap()
Indicates whether this field represents a map.boolean
isPacked()
Indicates whether a list field should be represented on the wire in packed form.boolean
isPrimitiveScalar()
Indicates whether this field type represents a primitive scalar value.boolean
isScalar()
Indicates whether this field type represents a scalar value.boolean
isValidForField(java.lang.reflect.Field field)
Indicates whether or not thisFieldType
can be applied to the givenField
.static FieldType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static FieldType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DOUBLE
public static final FieldType DOUBLE
-
FLOAT
public static final FieldType FLOAT
-
INT64
public static final FieldType INT64
-
UINT64
public static final FieldType UINT64
-
INT32
public static final FieldType INT32
-
FIXED64
public static final FieldType FIXED64
-
FIXED32
public static final FieldType FIXED32
-
BOOL
public static final FieldType BOOL
-
STRING
public static final FieldType STRING
-
MESSAGE
public static final FieldType MESSAGE
-
BYTES
public static final FieldType BYTES
-
UINT32
public static final FieldType UINT32
-
ENUM
public static final FieldType ENUM
-
SFIXED32
public static final FieldType SFIXED32
-
SFIXED64
public static final FieldType SFIXED64
-
SINT32
public static final FieldType SINT32
-
SINT64
public static final FieldType SINT64
-
GROUP
public static final FieldType GROUP
-
DOUBLE_LIST
public static final FieldType DOUBLE_LIST
-
FLOAT_LIST
public static final FieldType FLOAT_LIST
-
INT64_LIST
public static final FieldType INT64_LIST
-
UINT64_LIST
public static final FieldType UINT64_LIST
-
INT32_LIST
public static final FieldType INT32_LIST
-
FIXED64_LIST
public static final FieldType FIXED64_LIST
-
FIXED32_LIST
public static final FieldType FIXED32_LIST
-
BOOL_LIST
public static final FieldType BOOL_LIST
-
STRING_LIST
public static final FieldType STRING_LIST
-
MESSAGE_LIST
public static final FieldType MESSAGE_LIST
-
BYTES_LIST
public static final FieldType BYTES_LIST
-
UINT32_LIST
public static final FieldType UINT32_LIST
-
ENUM_LIST
public static final FieldType ENUM_LIST
-
SFIXED32_LIST
public static final FieldType SFIXED32_LIST
-
SFIXED64_LIST
public static final FieldType SFIXED64_LIST
-
SINT32_LIST
public static final FieldType SINT32_LIST
-
SINT64_LIST
public static final FieldType SINT64_LIST
-
DOUBLE_LIST_PACKED
public static final FieldType DOUBLE_LIST_PACKED
-
FLOAT_LIST_PACKED
public static final FieldType FLOAT_LIST_PACKED
-
INT64_LIST_PACKED
public static final FieldType INT64_LIST_PACKED
-
UINT64_LIST_PACKED
public static final FieldType UINT64_LIST_PACKED
-
INT32_LIST_PACKED
public static final FieldType INT32_LIST_PACKED
-
FIXED64_LIST_PACKED
public static final FieldType FIXED64_LIST_PACKED
-
FIXED32_LIST_PACKED
public static final FieldType FIXED32_LIST_PACKED
-
BOOL_LIST_PACKED
public static final FieldType BOOL_LIST_PACKED
-
UINT32_LIST_PACKED
public static final FieldType UINT32_LIST_PACKED
-
ENUM_LIST_PACKED
public static final FieldType ENUM_LIST_PACKED
-
SFIXED32_LIST_PACKED
public static final FieldType SFIXED32_LIST_PACKED
-
SFIXED64_LIST_PACKED
public static final FieldType SFIXED64_LIST_PACKED
-
SINT32_LIST_PACKED
public static final FieldType SINT32_LIST_PACKED
-
SINT64_LIST_PACKED
public static final FieldType SINT64_LIST_PACKED
-
GROUP_LIST
public static final FieldType GROUP_LIST
-
MAP
public static final FieldType MAP
-
-
Method Detail
-
values
public static FieldType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FieldType c : FieldType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FieldType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
id
public int id()
A reliable unique identifier for this type.
-
getJavaType
public JavaType getJavaType()
Gets theJavaType
for this field. For lists, this identifies the type of the elements contained within the list.
-
isPacked
public boolean isPacked()
Indicates whether a list field should be represented on the wire in packed form.
-
isPrimitiveScalar
public boolean isPrimitiveScalar()
Indicates whether this field type represents a primitive scalar value. If this istrue
, thenisScalar()
will also betrue
.
-
isScalar
public boolean isScalar()
Indicates whether this field type represents a scalar value.
-
isList
public boolean isList()
Indicates whether this field represents a list of values.
-
isMap
public boolean isMap()
Indicates whether this field represents a map.
-
isValidForField
public boolean isValidForField(java.lang.reflect.Field field)
Indicates whether or not thisFieldType
can be applied to the givenField
.
-
-