Class Decimals.Decimal.Builder

  • All Implemented Interfaces:
    Decimals.DecimalOrBuilder, com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, Cloneable
    Enclosing class:
    Decimals.Decimal

    public static final class Decimals.Decimal.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
    implements Decimals.DecimalOrBuilder
     Protobuf standard library / WellKnownTypes don't provide a Decimal type.
     This posses a challenge to represent Decimals that cannot be accurately represented
     using float or double types.
     Related issue: https://github.com/protocolbuffers/protobuf/issues/4406
     
    Protobuf type additionalTypes.Decimal
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • clear

        public Decimals.Decimal.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • getDefaultInstanceForType

        public Decimals.Decimal getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public Decimals.Decimal build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public Decimals.Decimal buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public Decimals.Decimal.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • setField

        public Decimals.Decimal.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                 Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • clearField

        public Decimals.Decimal.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • clearOneof

        public Decimals.Decimal.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • setRepeatedField

        public Decimals.Decimal.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                         int index,
                                                         Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • addRepeatedField

        public Decimals.Decimal.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                         Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • mergeFrom

        public Decimals.Decimal.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<Decimals.Decimal.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • mergeFrom

        public Decimals.Decimal.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                                  com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                           throws IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<Decimals.Decimal.Builder>
        Throws:
        IOException
      • getUnits

        public long getUnits()
         The whole units of the Decimal.
         This has to be a whole positive or negative or zero
         Ex: Units for -89.567800 will be -89
         
        int64 units = 1;
        Specified by:
        getUnits in interface Decimals.DecimalOrBuilder
        Returns:
        The units.
      • setUnits

        public Decimals.Decimal.Builder setUnits​(long value)
         The whole units of the Decimal.
         This has to be a whole positive or negative or zero
         Ex: Units for -89.567800 will be -89
         
        int64 units = 1;
        Parameters:
        value - The units to set.
        Returns:
        This builder for chaining.
      • clearUnits

        public Decimals.Decimal.Builder clearUnits()
         The whole units of the Decimal.
         This has to be a whole positive or negative or zero
         Ex: Units for -89.567800 will be -89
         
        int64 units = 1;
        Returns:
        This builder for chaining.
      • getFraction

        public int getFraction()
         Number of nano (10^9) units of the amount.
         The value must be between -999,999,999 and +999,999,999 inclusive.
         If `units` is positive, `nanos` must be positive or zero.
         If `units` is zero, `nanos` can be positive, zero, or negative.
         If `units` is negative, `nanos` must be negative or zero.
         Ex: -89.5678000 is represented as `units`=-89 and `nanos`=-567,800,000 (-0.567800 * 10^9)
         
        int32 fraction = 2;
        Specified by:
        getFraction in interface Decimals.DecimalOrBuilder
        Returns:
        The fraction.
      • setFraction

        public Decimals.Decimal.Builder setFraction​(int value)
         Number of nano (10^9) units of the amount.
         The value must be between -999,999,999 and +999,999,999 inclusive.
         If `units` is positive, `nanos` must be positive or zero.
         If `units` is zero, `nanos` can be positive, zero, or negative.
         If `units` is negative, `nanos` must be negative or zero.
         Ex: -89.5678000 is represented as `units`=-89 and `nanos`=-567,800,000 (-0.567800 * 10^9)
         
        int32 fraction = 2;
        Parameters:
        value - The fraction to set.
        Returns:
        This builder for chaining.
      • clearFraction

        public Decimals.Decimal.Builder clearFraction()
         Number of nano (10^9) units of the amount.
         The value must be between -999,999,999 and +999,999,999 inclusive.
         If `units` is positive, `nanos` must be positive or zero.
         If `units` is zero, `nanos` can be positive, zero, or negative.
         If `units` is negative, `nanos` must be negative or zero.
         Ex: -89.5678000 is represented as `units`=-89 and `nanos`=-567,800,000 (-0.567800 * 10^9)
         
        int32 fraction = 2;
        Returns:
        This builder for chaining.
      • getPrecision

        public int getPrecision()
         Represents the precision for the Decimal
         Precision can only be a positive integer.
         Ex: -89.567800 has precision of 8
         
        uint32 precision = 3;
        Specified by:
        getPrecision in interface Decimals.DecimalOrBuilder
        Returns:
        The precision.
      • setPrecision

        public Decimals.Decimal.Builder setPrecision​(int value)
         Represents the precision for the Decimal
         Precision can only be a positive integer.
         Ex: -89.567800 has precision of 8
         
        uint32 precision = 3;
        Parameters:
        value - The precision to set.
        Returns:
        This builder for chaining.
      • clearPrecision

        public Decimals.Decimal.Builder clearPrecision()
         Represents the precision for the Decimal
         Precision can only be a positive integer.
         Ex: -89.567800 has precision of 8
         
        uint32 precision = 3;
        Returns:
        This builder for chaining.
      • getScale

        public int getScale()
         Represents the scale for the Decimal
         Scale can be positive, zero or negative.
         Ex: -89.567800 has scale of 6
         -89.567800 represented with scale=0 is -89
         -89.567800 represented with scale=-1 is -80
         
        int32 scale = 4;
        Specified by:
        getScale in interface Decimals.DecimalOrBuilder
        Returns:
        The scale.
      • setScale

        public Decimals.Decimal.Builder setScale​(int value)
         Represents the scale for the Decimal
         Scale can be positive, zero or negative.
         Ex: -89.567800 has scale of 6
         -89.567800 represented with scale=0 is -89
         -89.567800 represented with scale=-1 is -80
         
        int32 scale = 4;
        Parameters:
        value - The scale to set.
        Returns:
        This builder for chaining.
      • clearScale

        public Decimals.Decimal.Builder clearScale()
         Represents the scale for the Decimal
         Scale can be positive, zero or negative.
         Ex: -89.567800 has scale of 6
         -89.567800 represented with scale=0 is -89
         -89.567800 represented with scale=-1 is -80
         
        int32 scale = 4;
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final Decimals.Decimal.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>
      • mergeUnknownFields

        public final Decimals.Decimal.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<Decimals.Decimal.Builder>