Package akka.protobuf

Class Descriptors.FieldDescriptor

    • Method Detail

      • getName

        public java.lang.String getName()
        Get the field's unqualified name.
      • getNumber

        public int getNumber()
        Get the field's number.
        Specified by:
        getNumber in interface akka.protobuf.FieldSet.FieldDescriptorLite<Descriptors.FieldDescriptor>
      • getJavaType

        public Descriptors.FieldDescriptor.JavaType getJavaType()
        Get the field's java type. This is just for convenience. Every FieldDescriptorProto.Type maps to exactly one Java type.
      • isRequired

        public boolean isRequired()
        Is this field declared required?
      • isOptional

        public boolean isOptional()
        Is this field declared optional?
      • isRepeated

        public boolean isRepeated()
        Is this field declared repeated?
        Specified by:
        isRepeated in interface akka.protobuf.FieldSet.FieldDescriptorLite<Descriptors.FieldDescriptor>
      • isPacked

        public boolean isPacked()
        Does this field have the [packed = true] option?
        Specified by:
        isPacked in interface akka.protobuf.FieldSet.FieldDescriptorLite<Descriptors.FieldDescriptor>
      • isPackable

        public boolean isPackable()
        Can this field be packed? i.e. is it a repeated primitive field?
      • hasDefaultValue

        public boolean hasDefaultValue()
        Returns true if the field had an explicitly-defined default value.
      • getDefaultValue

        public java.lang.Object getDefaultValue()
        Returns the field's default value. Valid for all types except for messages and groups. For all other types, the object returned is of the same class that would returned by Message.getField(this).
      • isExtension

        public boolean isExtension()
        Is this field an extension?
      • getContainingType

        public Descriptors.Descriptor getContainingType()
        Get the field's containing type. For extensions, this is the type being extended, not the location where the extension was defined. See getExtensionScope().
      • getExtensionScope

        public Descriptors.Descriptor getExtensionScope()
        For extensions defined nested within message types, gets the outer type. Not valid for non-extension fields. For example, consider this .proto file:
           message Foo {
             extensions 1000 to max;
           }
           extend Foo {
             optional int32 baz = 1234;
           }
           message Bar {
             extend Foo {
               optional int32 qux = 4321;
             }
           }
         
        Both baz's and qux's containing type is Foo. However, baz's extension scope is null while qux's extension scope is Bar.
      • getMessageType

        public Descriptors.Descriptor getMessageType()
        For embedded message and group fields, gets the field's type.
      • compareTo

        public int compareTo​(Descriptors.FieldDescriptor other)
        Compare with another FieldDescriptor. This orders fields in "canonical" order, which simply means ascending order by field number. other must be a field of the same type -- i.e. getContainingType() must return the same Descriptor for both fields.
        Specified by:
        compareTo in interface java.lang.Comparable<Descriptors.FieldDescriptor>
        Returns:
        negative, zero, or positive if this is less than, equal to, or greater than other, respectively.