Annotation Type 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:
    anistor@redhat.com
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Class<? extends Collection> collectionImplementation
      The actual concrete and instantiable implementation type of the Collection.
      String defaultValue
      The default value to assign to this field if it is found missing in the Protobuf data stream during reading.
      Class<?> javaType
      The actual concrete and instantiable Java type.
      String name
      The name of the field.
      int number
      The Protocol Buffers tag number.
      boolean required
      Marks the field as required.
      Type type
      The Protobuf type of the field.
      int value
      Alias for number().
    • Element Detail

      • 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:
        org.infinispan.protostream.descriptors.Type.MESSAGE
      • required

        boolean required
        Marks the field as required. Please use this sparingly as it will no longer be supported in Protobuf 3.0.
        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.

        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