Class FieldInfo.Builder

  • Enclosing class:
    FieldInfo

    public static final class FieldInfo.Builder
    extends java.lang.Object
    A builder for FieldInfo instances.
    • Field Detail

      • field

        private java.lang.reflect.Field field
      • fieldNumber

        private int fieldNumber
      • presenceField

        private java.lang.reflect.Field presenceField
      • presenceMask

        private int presenceMask
      • required

        private boolean required
      • enforceUtf8

        private boolean enforceUtf8
      • oneofStoredType

        private java.lang.Class<?> oneofStoredType
      • mapDefaultEntry

        private java.lang.Object mapDefaultEntry
      • cachedSizeField

        private java.lang.reflect.Field cachedSizeField
    • Constructor Detail

      • Builder

        private Builder()
    • Method Detail

      • withField

        public FieldInfo.Builder withField​(java.lang.reflect.Field field)
        Specifies the actual field on the message represented by this field. This should not be called for oneof member fields.
      • withFieldNumber

        public FieldInfo.Builder withFieldNumber​(int fieldNumber)
        Specifies the unique field number for this field within the message.
      • withPresence

        public FieldInfo.Builder withPresence​(java.lang.reflect.Field presenceField,
                                              int presenceMask)
        Specifies proto2 presence information. This should not be called for oneof fields.
      • withOneof

        public FieldInfo.Builder withOneof​(OneofInfo oneof,
                                           java.lang.Class<?> oneofStoredType)
        Sets the information for building a oneof member field. This is incompatible with withField(Field) and withPresence(Field, int).
        Parameters:
        oneof - the oneof for which this field is associated.
        oneofStoredType - the actual type stored in the oneof value for this field. Since the oneof value is an Object, primitives will store their boxed type.
      • withMapDefaultEntry

        public FieldInfo.Builder withMapDefaultEntry​(java.lang.Object mapDefaultEntry)
      • withEnforceUtf8

        public FieldInfo.Builder withEnforceUtf8​(boolean enforceUtf8)
      • withCachedSizeField

        public FieldInfo.Builder withCachedSizeField​(java.lang.reflect.Field cachedSizeField)