Annotation Interface ProtoField


@Target({FIELD,METHOD}) @Retention(RUNTIME) @Documented public @interface ProtoField
Defines a Protocol Buffers message field. A class must have at least one field/property annotated with ProtoField in order to be considered a Protocol Buffers message type.
Since:
3.0
Author:
[email protected]
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends Collection>
    The actual concrete and instantiable implementation type of the Collection.
    The default value to assign to this field if it is found missing in the Protobuf data stream during reading.
    The actual concrete and instantiable Java type.
    Class<? extends Map>
    The actual concrete and instantiable implementation type of the Map.
    The name of the field.
    int
    The Protocol Buffers tag number.
     
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    avoid using this
    The Protobuf type of the field.
    int
    Alias for number().
  • Element Details

    • value

      int value
      Alias for number().
      Default:
      0
    • number

      int number
      The Protocol Buffers tag number.
      Default:
      0
    • type

      Type type
      The Protobuf type of the field. If not specified, then the field type will be inferred based on the Java property type.
      Default:
      MESSAGE
    • required

      @Deprecated(since="5.0", forRemoval=true) boolean required
      Deprecated, for removal: This API element is subject to removal in a future version.
      avoid using this
      Marks the field as required. This is valid only when using the Protocol Buffers 2 syntax.
      Default:
      false
    • name

      String name
      The name of the field. If not specified, then the name of the Java property is used instead.
      Default:
      ""
    • defaultValue

      String defaultValue
      The default value to assign to this field if it is found missing in the Protobuf data stream during reading.

      The value is given in the form of a string that must obey correct syntax (as defined by Protobuf spec.) in order to be parsed into the actual value which may be of a different type than string.

      This value has no significance during writing of a null field, ie. it does not get written into the data stream as a substitute for the missing value. It is expected that the reader of this Protobuf stream will do that when reading it back. This is valid only when using the Protocol Buffers 2 syntax.

      Default:
      ""
    • javaType

      Class<?> javaType
      The actual concrete and instantiable Java type. This Class should be assignable to the property type. It should be used when the type is an interface or abstract class in order to designate the actual concrete class that must be instantiated by the marshaling layer when reading this from a data stream.
      Default:
      void.class
    • collectionImplementation

      Class<? extends Collection> collectionImplementation
      The actual concrete and instantiable implementation type of the Collection. This Class should only be specified if the Java property type is really a Collection and must be assignable to the property type. It should be used when the type of the Collection is an interface or an abstract class in order to designate the actual concrete class that must be instantiated by the marshaling layer when reading this from a data stream.
      Default:
      java.util.Collection.class
    • mapImplementation

      Class<? extends Map> mapImplementation
      The actual concrete and instantiable implementation type of the Map. This Class should only be specified if the Java property type is really a Map and must be assignable to the property type. It should be used when the type of the Map is an interface or an abstract class in order to designate the actual concrete class that must be instantiated by the marshaling layer when reading this from a data stream.
      Default:
      java.util.Map.class
    • oneof

      String oneof
      Default:
      ""