Class TupleFieldsHelper
- java.lang.Object
-
- com.apple.foundationdb.record.metadata.expressions.TupleFieldsHelper
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
fromProto(TupleFieldsProto.NullableBool proto)
Convert a ProtobufNullableBool
to a Javaboolean
.static ByteString
fromProto(TupleFieldsProto.NullableBytes proto)
Convert a ProtobufNullableBytes
to a JavaByteString
.static double
fromProto(TupleFieldsProto.NullableDouble proto)
Convert a ProtobufNullableDouble
to a Javadouble
.static float
fromProto(TupleFieldsProto.NullableFloat proto)
Convert a ProtobufNullableFloat
to a Javafloat
.static int
fromProto(TupleFieldsProto.NullableInt32 proto)
Convert a ProtobufNullableInt32
to a Javaint
.static long
fromProto(TupleFieldsProto.NullableInt64 proto)
Convert a ProtobufNullableInt64
to a Javalong
.static String
fromProto(TupleFieldsProto.NullableString proto)
Convert a ProtobufNullableString
to a JavaString
.static UUID
fromProto(TupleFieldsProto.UUID proto)
Convert a ProtobufUUID
to a JavaUUID
.static Object
fromProto(Message value, Descriptors.Descriptor descriptor)
Convert a field's value from a message to aTuple
item.static boolean
isTupleField(Descriptors.Descriptor descriptor)
Test whether a message field's descriptor is one of the special ones.static TupleFieldsProto.NullableBool
toProto(boolean value)
Convert a Javaboolean
to a ProtobufNullableBool
.static TupleFieldsProto.NullableDouble
toProto(double value)
Convert a Javadouble
to a ProtobufNullableDouble
.static TupleFieldsProto.NullableFloat
toProto(float value)
Convert a Javafloat
to a ProtobufNullableFloat
.static TupleFieldsProto.NullableInt32
toProto(int value)
Convert a Javaint
to a ProtobufNullableInt32
.static TupleFieldsProto.NullableInt64
toProto(long value)
Convert a Javalong
to a ProtobufNullableInt64
.static TupleFieldsProto.NullableBytes
toProto(ByteString value)
Convert a JavaByteString
to a ProtobufNullableBytes
.static Message
toProto(Object value, Descriptors.Descriptor descriptor)
Convert a field's value from aTuple
item to a message.static TupleFieldsProto.NullableString
toProto(String value)
Convert a JavaString
to a ProtobufNullableString
.static TupleFieldsProto.UUID
toProto(UUID uuid)
Convert a JavaUUID
to a ProtobufUUID
.
-
-
-
Method Detail
-
isTupleField
public static boolean isTupleField(@Nonnull Descriptors.Descriptor descriptor)
Test whether a message field's descriptor is one of the special ones.- Parameters:
descriptor
- message descriptor for the field- Returns:
true
if the field is decoded into a single item in aTuple
.
-
fromProto
@Nonnull public static Object fromProto(@Nonnull Message value, @Nonnull Descriptors.Descriptor descriptor)
Convert a field's value from a message to aTuple
item.- Parameters:
value
- value for the fielddescriptor
- message descriptor for the field- Returns:
- an object suitable for storing in a
Tuple
-
fromProto
@Nonnull public static UUID fromProto(@Nonnull TupleFieldsProto.UUID proto)
Convert a ProtobufUUID
to a JavaUUID
.- Parameters:
proto
- the value of a ProtobufUUID
field- Returns:
- the decoded Java
UUID
-
fromProto
public static double fromProto(@Nonnull TupleFieldsProto.NullableDouble proto)
Convert a ProtobufNullableDouble
to a Javadouble
.- Parameters:
proto
- the value of a ProtobufNullableDouble
field- Returns:
- the decoded Java
double
-
fromProto
public static float fromProto(@Nonnull TupleFieldsProto.NullableFloat proto)
Convert a ProtobufNullableFloat
to a Javafloat
.- Parameters:
proto
- the value of a ProtobufNullableFloat
field- Returns:
- the decoded Java
float
-
fromProto
public static int fromProto(@Nonnull TupleFieldsProto.NullableInt32 proto)
Convert a ProtobufNullableInt32
to a Javaint
.- Parameters:
proto
- the value of a ProtobufNullableInt32
field- Returns:
- the decoded Java
int
-
fromProto
public static long fromProto(@Nonnull TupleFieldsProto.NullableInt64 proto)
Convert a ProtobufNullableInt64
to a Javalong
.- Parameters:
proto
- the value of a ProtobufNullableInt64
field- Returns:
- the decoded Java
long
-
fromProto
public static boolean fromProto(@Nonnull TupleFieldsProto.NullableBool proto)
Convert a ProtobufNullableBool
to a Javaboolean
.- Parameters:
proto
- the value of a ProtobufNullableBool
field- Returns:
- the decoded Java
boolean
-
fromProto
@Nonnull public static String fromProto(@Nonnull TupleFieldsProto.NullableString proto)
Convert a ProtobufNullableString
to a JavaString
.- Parameters:
proto
- the value of a ProtobufNullableString
field- Returns:
- the decoded Java
String
-
fromProto
@Nonnull public static ByteString fromProto(@Nonnull TupleFieldsProto.NullableBytes proto)
Convert a ProtobufNullableBytes
to a JavaByteString
.- Parameters:
proto
- the value of a ProtobufNullableBytes
field- Returns:
- the decoded Java
ByteString
-
toProto
@Nonnull public static Message toProto(@Nonnull Object value, @Nonnull Descriptors.Descriptor descriptor)
Convert a field's value from aTuple
item to a message.- Parameters:
value
- value for the fielddescriptor
- message descriptor for the field- Returns:
- an object suitable for storing in the field
-
toProto
@Nonnull public static TupleFieldsProto.UUID toProto(@Nonnull UUID uuid)
Convert a JavaUUID
to a ProtobufUUID
.- Parameters:
uuid
- the JavaUUID
- Returns:
- a message to set as the value of a Protobuf
UUID
field
-
toProto
@Nonnull public static TupleFieldsProto.NullableDouble toProto(double value)
Convert a Javadouble
to a ProtobufNullableDouble
.- Parameters:
value
- the Javadouble
- Returns:
- a message to set as the value of a Protobuf
NullableDouble
field
-
toProto
@Nonnull public static TupleFieldsProto.NullableFloat toProto(float value)
Convert a Javafloat
to a ProtobufNullableFloat
.- Parameters:
value
- the Javafloat
- Returns:
- a message to set as the value of a Protobuf
NullableFloat
field
-
toProto
@Nonnull public static TupleFieldsProto.NullableInt32 toProto(int value)
Convert a Javaint
to a ProtobufNullableInt32
.- Parameters:
value
- the Javaint
- Returns:
- a message to set as the value of a Protobuf
NullableInt32
field
-
toProto
@Nonnull public static TupleFieldsProto.NullableInt64 toProto(long value)
Convert a Javalong
to a ProtobufNullableInt64
.- Parameters:
value
- the Javalong
- Returns:
- a message to set as the value of a Protobuf
NullableInt64
field
-
toProto
@Nonnull public static TupleFieldsProto.NullableBool toProto(boolean value)
Convert a Javaboolean
to a ProtobufNullableBool
.- Parameters:
value
- the Javaboolean
- Returns:
- a message to set as the value of a Protobuf
NullableBool
field
-
toProto
@Nonnull public static TupleFieldsProto.NullableString toProto(@Nonnull String value)
Convert a JavaString
to a ProtobufNullableString
.- Parameters:
value
- the JavaString
- Returns:
- a message to set as the value of a Protobuf
NullableString
field
-
toProto
@Nonnull public static TupleFieldsProto.NullableBytes toProto(@Nonnull ByteString value)
Convert a JavaByteString
to a ProtobufNullableBytes
.- Parameters:
value
- the JavaByteString
- Returns:
- a message to set as the value of a Protobuf
NullableBytes
field
-
-