# Annotation Type ProtoField

@Retention(CLASS) @Target(FIELD) public @interface ProtoField

Binds a `ProtoMessage` field to a protobuf field tag. Tags must be positive, unique within the message, and correspond to the tag declared in the upstream `.proto` file.

Optional `wireType()` forces a non-default scalar encoding for integer fields. Defaults to `ProtoField.WireKind.DEFAULT`, which selects varint for `int32` / `int64` / `bool`, fixed32 / fixed64 for `float` / `double`, and length-delimited for strings, byte arrays, nested messages, and `repeated` packed scalars. Specify `ProtoField.WireKind.SINT` for ZigZag-encoded signed integers, or `ProtoField.WireKind.FIXED` for fixed-width unsigned integers (matches `fixed32` / `fixed64` in proto3).

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `ProtoField.WireKind`
  Integer encoding selectors.

- ## Required Element Summary

  Required Elements
  Modifier and Type
  Required Element
  Description
  `int`
  `tag`
  Protobuf field tag (positive integer, unique per message).

- ## Optional Element Summary

  Optional Elements
  Modifier and Type
  Optional Element
  Description
  `String`
  `name`
  Optional override of the Java field name when the generator had to rename it to a valid identifier.
  `ProtoField.WireKind`
  `wireType`
  Non-default integer encoding selector.

- ## Element Details

  - ### tag

    int tag
    Protobuf field tag (positive integer, unique per message).

  - ### name

    String name
    Optional override of the Java field name when the generator had to rename it to a valid identifier. Carries the original `.proto` name so introspection tooling can recover it.
    Default:
      `""`

  - ### wireType

    ProtoField.WireKind wireType
    Non-default integer encoding selector. Has no effect for non-integer fields.
    Default:
      `DEFAULT`