public final class Decimal extends com.google.protobuf.GeneratedMessageV3 implements DecimalOrBuilder
A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. [BigDecimal]: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html [decimal.Decimal]: https://docs.python.org/3/library/decimal.htmlProtobuf type
google.type.Decimal| Modifier and Type | Class and Description |
|---|---|
static class |
Decimal.Builder
A representation of a decimal value, such as 2.5.
|
com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage,BuilderType extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType,BuilderType>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter| Modifier and Type | Field and Description |
|---|---|
static int |
VALUE_FIELD_NUMBER |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static Decimal |
getDefaultInstance() |
Decimal |
getDefaultInstanceForType() |
static com.google.protobuf.Descriptors.Descriptor |
getDescriptor() |
com.google.protobuf.Parser<Decimal> |
getParserForType() |
int |
getSerializedSize() |
com.google.protobuf.UnknownFieldSet |
getUnknownFields() |
String |
getValue()
The decimal value, as a string.
|
com.google.protobuf.ByteString |
getValueBytes()
The decimal value, as a string.
|
int |
hashCode() |
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable |
internalGetFieldAccessorTable() |
boolean |
isInitialized() |
static Decimal.Builder |
newBuilder() |
static Decimal.Builder |
newBuilder(Decimal prototype) |
Decimal.Builder |
newBuilderForType() |
protected Decimal.Builder |
newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) |
protected Object |
newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused) |
static Decimal |
parseDelimitedFrom(InputStream input) |
static Decimal |
parseDelimitedFrom(InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Decimal |
parseFrom(byte[] data) |
static Decimal |
parseFrom(byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Decimal |
parseFrom(ByteBuffer data) |
static Decimal |
parseFrom(ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Decimal |
parseFrom(com.google.protobuf.ByteString data) |
static Decimal |
parseFrom(com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Decimal |
parseFrom(com.google.protobuf.CodedInputStream input) |
static Decimal |
parseFrom(com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static Decimal |
parseFrom(InputStream input) |
static Decimal |
parseFrom(InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry) |
static com.google.protobuf.Parser<Decimal> |
parser() |
Decimal.Builder |
toBuilder() |
void |
writeTo(com.google.protobuf.CodedOutputStream output) |
canUseUnsafe, computeStringSize, computeStringSizeNoTag, emptyBooleanList, emptyDoubleList, emptyFloatList, emptyIntList, emptyLongList, getAllFields, getDescriptorForType, getField, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, hasField, hasOneof, internalGetMapField, isStringEmpty, makeExtensionsImmutable, mergeFromAndMakeImmutableInternal, mutableCopy, mutableCopy, mutableCopy, mutableCopy, mutableCopy, newBooleanList, newBuilderForType, newDoubleList, newFloatList, newIntList, newLongList, parseDelimitedWithIOException, parseDelimitedWithIOException, parseUnknownField, parseUnknownFieldProto3, parseWithIOException, parseWithIOException, parseWithIOException, parseWithIOException, serializeBooleanMapTo, serializeIntegerMapTo, serializeLongMapTo, serializeStringMapTo, writeReplace, writeString, writeStringNoTagfindInitializationErrors, getInitializationErrorString, hashBoolean, hashEnum, hashEnumList, hashFields, hashLong, toStringaddAll, addAll, checkByteStringIsUtf8, toByteArray, toByteString, writeDelimitedTo, writeToclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic static final int VALUE_FIELD_NUMBER
protected Object newInstance(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
newInstance in class com.google.protobuf.GeneratedMessageV3public final com.google.protobuf.UnknownFieldSet getUnknownFields()
getUnknownFields in interface com.google.protobuf.MessageOrBuildergetUnknownFields in class com.google.protobuf.GeneratedMessageV3public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3public String getValue()
The decimal value, as a string.
The string representation consists of an optional sign, `+` (`U+002B`)
or `-` (`U+002D`), followed by a sequence of zero or more decimal digits
("the integer"), optionally followed by a fraction, optionally followed
by an exponent.
The fraction consists of a decimal point followed by zero or more decimal
digits. The string must contain at least one digit in either the integer
or the fraction. The number formed by the sign, the integer and the
fraction is referred to as the significand.
The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)
followed by one or more decimal digits.
Services **should** normalize decimal values before storing them by:
- Removing an explicitly-provided `+` sign (`+2.5` -> `2.5`).
- Replacing a zero-length integer value with `0` (`.5` -> `0.5`).
- Coercing the exponent character to lower-case (`2.5E8` -> `2.5e8`).
- Removing an explicitly-provided zero exponent (`2.5e0` -> `2.5`).
Services **may** perform additional normalization based on its own needs
and the internal decimal implementation selected, such as shifting the
decimal point and exponent value together (example: `2.5e-1` <-> `0.25`).
Additionally, services **may** preserve trailing zeroes in the fraction
to indicate increased precision, but are not required to do so.
Note that only the `.` character is supported to divide the integer
and the fraction; `,` **should not** be supported regardless of locale.
Additionally, thousand separators **should not** be supported. If a
service does support them, values **must** be normalized.
The ENBF grammar is:
DecimalString =
[Sign] Significand [Exponent];
Sign = '+' | '-';
Significand =
Digits ['.'] [Digits] | [Digits] '.' Digits;
Exponent = ('e' | 'E') [Sign] Digits;
Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };
Services **should** clearly document the range of supported values, the
maximum supported precision (total number of digits), and, if applicable,
the scale (number of digits after the decimal point), as well as how it
behaves when receiving out-of-bounds values.
Services **may** choose to accept values passed as input even when the
value has a higher precision or scale than the service supports, and
**should** round the value to fit the supported scale. Alternatively, the
service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)
if precision would be lost.
Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in
gRPC) if the service receives a value outside of the supported range.
string value = 1;getValue in interface DecimalOrBuilderpublic com.google.protobuf.ByteString getValueBytes()
The decimal value, as a string.
The string representation consists of an optional sign, `+` (`U+002B`)
or `-` (`U+002D`), followed by a sequence of zero or more decimal digits
("the integer"), optionally followed by a fraction, optionally followed
by an exponent.
The fraction consists of a decimal point followed by zero or more decimal
digits. The string must contain at least one digit in either the integer
or the fraction. The number formed by the sign, the integer and the
fraction is referred to as the significand.
The exponent consists of the character `e` (`U+0065`) or `E` (`U+0045`)
followed by one or more decimal digits.
Services **should** normalize decimal values before storing them by:
- Removing an explicitly-provided `+` sign (`+2.5` -> `2.5`).
- Replacing a zero-length integer value with `0` (`.5` -> `0.5`).
- Coercing the exponent character to lower-case (`2.5E8` -> `2.5e8`).
- Removing an explicitly-provided zero exponent (`2.5e0` -> `2.5`).
Services **may** perform additional normalization based on its own needs
and the internal decimal implementation selected, such as shifting the
decimal point and exponent value together (example: `2.5e-1` <-> `0.25`).
Additionally, services **may** preserve trailing zeroes in the fraction
to indicate increased precision, but are not required to do so.
Note that only the `.` character is supported to divide the integer
and the fraction; `,` **should not** be supported regardless of locale.
Additionally, thousand separators **should not** be supported. If a
service does support them, values **must** be normalized.
The ENBF grammar is:
DecimalString =
[Sign] Significand [Exponent];
Sign = '+' | '-';
Significand =
Digits ['.'] [Digits] | [Digits] '.' Digits;
Exponent = ('e' | 'E') [Sign] Digits;
Digits = { '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' };
Services **should** clearly document the range of supported values, the
maximum supported precision (total number of digits), and, if applicable,
the scale (number of digits after the decimal point), as well as how it
behaves when receiving out-of-bounds values.
Services **may** choose to accept values passed as input even when the
value has a higher precision or scale than the service supports, and
**should** round the value to fit the supported scale. Alternatively, the
service **may** error with `400 Bad Request` (`INVALID_ARGUMENT` in gRPC)
if precision would be lost.
Services **should** error with `400 Bad Request` (`INVALID_ARGUMENT` in
gRPC) if the service receives a value outside of the supported range.
string value = 1;getValueBytes in interface DecimalOrBuilderpublic final boolean isInitialized()
isInitialized in interface com.google.protobuf.MessageLiteOrBuilderisInitialized in class com.google.protobuf.GeneratedMessageV3public void writeTo(com.google.protobuf.CodedOutputStream output)
throws IOException
writeTo in interface com.google.protobuf.MessageLitewriteTo in class com.google.protobuf.GeneratedMessageV3IOExceptionpublic int getSerializedSize()
getSerializedSize in interface com.google.protobuf.MessageLitegetSerializedSize in class com.google.protobuf.GeneratedMessageV3public boolean equals(Object obj)
equals in interface com.google.protobuf.Messageequals in class com.google.protobuf.AbstractMessagepublic int hashCode()
hashCode in interface com.google.protobuf.MessagehashCode in class com.google.protobuf.AbstractMessagepublic static Decimal parseFrom(ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Decimal parseFrom(ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Decimal parseFrom(com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Decimal parseFrom(com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Decimal parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Decimal parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException
com.google.protobuf.InvalidProtocolBufferExceptionpublic static Decimal parseFrom(InputStream input) throws IOException
IOExceptionpublic static Decimal parseFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static Decimal parseDelimitedFrom(InputStream input) throws IOException
IOExceptionpublic static Decimal parseDelimitedFrom(InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic static Decimal parseFrom(com.google.protobuf.CodedInputStream input) throws IOException
IOExceptionpublic static Decimal parseFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
IOExceptionpublic Decimal.Builder newBuilderForType()
newBuilderForType in interface com.google.protobuf.MessagenewBuilderForType in interface com.google.protobuf.MessageLitepublic static Decimal.Builder newBuilder()
public static Decimal.Builder newBuilder(Decimal prototype)
public Decimal.Builder toBuilder()
toBuilder in interface com.google.protobuf.MessagetoBuilder in interface com.google.protobuf.MessageLiteprotected Decimal.Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
newBuilderForType in class com.google.protobuf.GeneratedMessageV3public static Decimal getDefaultInstance()
public static com.google.protobuf.Parser<Decimal> parser()
public com.google.protobuf.Parser<Decimal> getParserForType()
getParserForType in interface com.google.protobuf.MessagegetParserForType in interface com.google.protobuf.MessageLitegetParserForType in class com.google.protobuf.GeneratedMessageV3public Decimal getDefaultInstanceForType()
getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuildergetDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilderCopyright © 2022 Google LLC. All rights reserved.