Class MoreValues
java.lang.Object
com.google.mu.protobuf.util.MoreValues
Additional utilities to help create
Value and ListValue messages.- Since:
- 5.8
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionasList(com.google.protobuf.ListValueOrBuilder listValue) Returns aList<Object>view overlistValue.static @Nullable ObjectfromValue(com.google.protobuf.ValueOrBuilder value) Unwrapsvalue.static com.google.protobuf.ListValuelistValueOf(double... values) ReturnsListValuewrappingvalues.static com.google.protobuf.ListValuelistValueOf(@Nullable com.google.protobuf.Struct... values) ReturnsListValuewrappingvalues.static com.google.protobuf.ListValuelistValueOf(@Nullable String... values) ReturnsListValuewrappingvalues.static com.google.protobuf.ValuenullableValueOf(@Nullable String string) static Collector<com.google.protobuf.Value, ?, com.google.protobuf.ListValue> Returns aCollectorthat collects the input values intoListValue.
-
Field Details
-
NULL
public static final com.google.protobuf.Value NULLTheValuefor null. -
TRUE
public static final com.google.protobuf.Value TRUETheValuefor booleantrue. -
FALSE
public static final com.google.protobuf.Value FALSETheValuefor booleanfalse.
-
-
Method Details
-
nullableValueOf
-
listValueOf
public static com.google.protobuf.ListValue listValueOf(double... values) ReturnsListValuewrappingvalues. -
listValueOf
-
listValueOf
public static com.google.protobuf.ListValue listValueOf(@Nullable com.google.protobuf.Struct... values) -
toListValue
-
fromValue
Unwrapsvalue.For example,
Values.of(1)is unwrapped to1;ListValueis unwrapped asList<Object>;Structis unwrapped asMap<String, Object>; andNullValueis unwrapped asnull, etc.Note that integral numbers in the range of
intwill be unwrapped asInteger; while integral numbers otherwise in the range oflongwill 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
valueis 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
-