Class MoreValues
Value
and ListValue
messages.- Since:
- 5.8
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionasList
(com.google.protobuf.ListValueOrBuilder listValue) Returns aList<Object>
view overlistValue
.static @Nullable Object
fromValue
(com.google.protobuf.ValueOrBuilder value) Unwrapsvalue
.static com.google.protobuf.ListValue
listValueOf
(double... values) ReturnsListValue
wrappingvalues
.static com.google.protobuf.ListValue
listValueOf
(@Nullable com.google.protobuf.Struct... values) ReturnsListValue
wrappingvalues
.static com.google.protobuf.ListValue
listValueOf
(@Nullable String... values) ReturnsListValue
wrappingvalues
.static com.google.protobuf.Value
nullableValueOf
(@Nullable String string) static Collector
<com.google.protobuf.Value, ?, com.google.protobuf.ListValue> Returns aCollector
that collects the input values intoListValue
.
-
Field Details
-
NULL
public static final com.google.protobuf.Value NULLTheValue
for null. -
TRUE
public static final com.google.protobuf.Value TRUETheValue
for booleantrue
. -
FALSE
public static final com.google.protobuf.Value FALSETheValue
for booleanfalse
.
-
-
Method Details
-
nullableValueOf
-
listValueOf
public static com.google.protobuf.ListValue listValueOf(double... values) ReturnsListValue
wrappingvalues
. -
listValueOf
-
listValueOf
public static com.google.protobuf.ListValue listValueOf(@Nullable com.google.protobuf.Struct... values) -
toListValue
Returns aCollector
that collects the input values intoListValue
. -
fromValue
Unwrapsvalue
.For example,
Values.of(1)
is unwrapped to1
;ListValue
is unwrapped asList<Object>
;Struct
is unwrapped asMap<String, Object>
; andNullValue
is unwrapped asnull
, etc.Note that integral numbers in the range of
int
will be unwrapped asInteger
; while integral numbers otherwise in the range oflong
will be unwrapped asLong
. All other numbers are unwrapped asDouble
. If you need to handle all number cases unconditionally, consider to useNumber.doubleValue()
.The returned object is immutable. Even if
value
is an instance ofValue.Builder
, and the underlying state is changed after this method returns, the returned object remains unchanged.- Since:
- 5.9
- See Also:
-
asList
Returns aList<Object>
view overlistValue
.For example,
Values.of(1)
is unwrapped to1L
;Struct
is unwrapped asMap<String, Object>
; andNullValue
is unwrapped asnull
, etc.- Since:
- 5.9
- See Also:
-