Package com.google.protobuf
Enum Class FieldType
- All Implemented Interfaces:
Serializable,Comparable<FieldType>,Constable
Enumeration identifying all relevant type information for a protobuf field.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FieldType.Collectionprivate final Class<?>private static final Type[]private final intprivate final JavaTypeprivate final booleanprivate static final FieldType[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateFieldType(int id, FieldType.Collection collection, JavaType javaType) -
Method Summary
Modifier and TypeMethodDescriptionstatic FieldTypeforId(int id) Looks up the appropriateFieldTypeby it's identifier.private static TypegetGenericSuperList(Class<?> clazz) Given a class, finds a generic super class or interface that extendsList.Gets theJavaTypefor this field.private static TypegetListParameter(Class<?> clazz, Type[] realTypes) Inspects the inheritance hierarchy for the given class and finds the generic type parameter forList.intid()A reliable unique identifier for this type.booleanisList()Indicates whether this field represents a list of values.booleanisMap()Indicates whether this field represents a map.booleanisPacked()Indicates whether a list field should be represented on the wire in packed form.booleanIndicates whether this field type represents a primitive scalar value.booleanisScalar()Indicates whether this field type represents a scalar value.booleanisValidForField(Field field) private booleanisValidForList(Field field) static FieldTypeReturns the enum constant of this class with the specified name.static FieldType[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DOUBLE
-
FLOAT
-
INT64
-
UINT64
-
INT32
-
FIXED64
-
FIXED32
-
BOOL
-
STRING
-
MESSAGE
-
BYTES
-
UINT32
-
ENUM
-
SFIXED32
-
SFIXED64
-
SINT32
-
SINT64
-
GROUP
-
DOUBLE_LIST
-
FLOAT_LIST
-
INT64_LIST
-
UINT64_LIST
-
INT32_LIST
-
FIXED64_LIST
-
FIXED32_LIST
-
BOOL_LIST
-
STRING_LIST
-
MESSAGE_LIST
-
BYTES_LIST
-
UINT32_LIST
-
ENUM_LIST
-
SFIXED32_LIST
-
SFIXED64_LIST
-
SINT32_LIST
-
SINT64_LIST
-
DOUBLE_LIST_PACKED
-
FLOAT_LIST_PACKED
-
INT64_LIST_PACKED
-
UINT64_LIST_PACKED
-
INT32_LIST_PACKED
-
FIXED64_LIST_PACKED
-
FIXED32_LIST_PACKED
-
BOOL_LIST_PACKED
-
UINT32_LIST_PACKED
-
ENUM_LIST_PACKED
-
SFIXED32_LIST_PACKED
-
SFIXED64_LIST_PACKED
-
SINT32_LIST_PACKED
-
SINT64_LIST_PACKED
-
GROUP_LIST
-
MAP
-
-
Field Details
-
javaType
-
id
private final int id -
collection
-
elementType
-
primitiveScalar
private final boolean primitiveScalar -
VALUES
-
EMPTY_TYPES
-
-
Constructor Details
-
FieldType
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
id
public int id()A reliable unique identifier for this type. -
getJavaType
Gets theJavaTypefor 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
-
isValidForList
-
forId
Looks up the appropriateFieldTypeby it's identifier.- Returns:
- the
FieldTypeornullif not found.
-
getGenericSuperList
Given a class, finds a generic super class or interface that extendsList.- Returns:
- the generic super class/interface, or
nullif not found.
-
getListParameter
Inspects the inheritance hierarchy for the given class and finds the generic type parameter forList.- Parameters:
clazz- the class to begin the search.realTypes- the array of actual type parameters forclazz. These will be used to substitute generic parameters up the inheritance hierarchy. Ifclazzdoes not have any generic parameters, this list should be empty.- Returns:
- the
Listparameter.
-