Class TupleFieldsHelper


  • @API(INTERNAL)
    public class TupleFieldsHelper
    extends Object
    Static methods for dealing with special field types that are messages in protobuf but single items in Tuples.
    • 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 a Tuple.
      • fromProto

        public static double fromProto​(@Nonnull
                                       TupleFieldsProto.NullableDouble proto)
        Convert a Protobuf NullableDouble to a Java double.
        Parameters:
        proto - the value of a Protobuf NullableDouble field
        Returns:
        the decoded Java double
      • fromProto

        public static float fromProto​(@Nonnull
                                      TupleFieldsProto.NullableFloat proto)
        Convert a Protobuf NullableFloat to a Java float.
        Parameters:
        proto - the value of a Protobuf NullableFloat field
        Returns:
        the decoded Java float
      • fromProto

        public static int fromProto​(@Nonnull
                                    TupleFieldsProto.NullableInt32 proto)
        Convert a Protobuf NullableInt32 to a Java int.
        Parameters:
        proto - the value of a Protobuf NullableInt32 field
        Returns:
        the decoded Java int
      • fromProto

        public static long fromProto​(@Nonnull
                                     TupleFieldsProto.NullableInt64 proto)
        Convert a Protobuf NullableInt64 to a Java long.
        Parameters:
        proto - the value of a Protobuf NullableInt64 field
        Returns:
        the decoded Java long
      • fromProto

        public static boolean fromProto​(@Nonnull
                                        TupleFieldsProto.NullableBool proto)
        Convert a Protobuf NullableBool to a Java boolean.
        Parameters:
        proto - the value of a Protobuf NullableBool field
        Returns:
        the decoded Java boolean
      • toProto

        @Nonnull
        public static TupleFieldsProto.UUID toProto​(@Nonnull
                                                    UUID uuid)
        Convert a Java UUID to a Protobuf UUID.
        Parameters:
        uuid - the Java UUID
        Returns:
        a message to set as the value of a Protobuf UUID field
      • toProto

        @Nonnull
        public static TupleFieldsProto.NullableDouble toProto​(double value)
        Convert a Java double to a Protobuf NullableDouble.
        Parameters:
        value - the Java double
        Returns:
        a message to set as the value of a Protobuf NullableDouble field
      • toProto

        @Nonnull
        public static TupleFieldsProto.NullableFloat toProto​(float value)
        Convert a Java float to a Protobuf NullableFloat.
        Parameters:
        value - the Java float
        Returns:
        a message to set as the value of a Protobuf NullableFloat field
      • toProto

        @Nonnull
        public static TupleFieldsProto.NullableInt32 toProto​(int value)
        Convert a Java int to a Protobuf NullableInt32.
        Parameters:
        value - the Java int
        Returns:
        a message to set as the value of a Protobuf NullableInt32 field
      • toProto

        @Nonnull
        public static TupleFieldsProto.NullableInt64 toProto​(long value)
        Convert a Java long to a Protobuf NullableInt64.
        Parameters:
        value - the Java long
        Returns:
        a message to set as the value of a Protobuf NullableInt64 field
      • toProto

        @Nonnull
        public static TupleFieldsProto.NullableBool toProto​(boolean value)
        Convert a Java boolean to a Protobuf NullableBool.
        Parameters:
        value - the Java boolean
        Returns:
        a message to set as the value of a Protobuf NullableBool field