Class Transforms

    • Method Detail

      • fromString

        public static Transform<?,​?> fromString​(Type type,
                                                      java.lang.String transform)
      • identity

        public static <T> Transform<T,​T> identity​(Type type)
        Returns an identity Transform that can be used for any type.
        Type Parameters:
        T - Java type passed to this transform
        Parameters:
        type - the source type for the transform
        Returns:
        an identity transform
      • year

        public static <T> Transform<T,​java.lang.Integer> year​(Type type)
        Returns a year Transform for date or timestamp types.
        Type Parameters:
        T - Java type passed to this transform
        Parameters:
        type - the source type for the transform
        Returns:
        a year transform
      • month

        public static <T> Transform<T,​java.lang.Integer> month​(Type type)
        Returns a month Transform for date or timestamp types.
        Type Parameters:
        T - Java type passed to this transform
        Parameters:
        type - the source type for the transform
        Returns:
        a month transform
      • day

        public static <T> Transform<T,​java.lang.Integer> day​(Type type)
        Returns a day Transform for date or timestamp types.
        Type Parameters:
        T - Java type passed to this transform
        Parameters:
        type - the source type for the transform
        Returns:
        a day transform
      • hour

        public static <T> Transform<T,​java.lang.Integer> hour​(Type type)
        Returns a hour Transform for timestamps.
        Type Parameters:
        T - Java type passed to this transform
        Parameters:
        type - the source type for the transform
        Returns:
        a hour transform
      • bucket

        public static <T> Transform<T,​java.lang.Integer> bucket​(Type type,
                                                                      int numBuckets)
        Returns a bucket Transform for the given type and number of buckets.
        Type Parameters:
        T - Java type passed to this transform
        Parameters:
        type - the source type for the transform
        numBuckets - the number of buckets for the transform to produce
        Returns:
        a transform that buckets values into numBuckets
      • truncate

        public static <T> Transform<T,​T> truncate​(Type type,
                                                        int width)
        Returns a truncate Transform for the given type and width.
        Type Parameters:
        T - Java type passed to this transform
        Parameters:
        type - the source type for the transform
        width - the width to truncate data values
        Returns:
        a transform that truncates the given type to width
      • alwaysNull

        public static <T> Transform<T,​java.lang.Void> alwaysNull()
        Returns a Transform that always produces null.
        Type Parameters:
        T - Java type accepted by the transform.
        Returns:
        a transform that always produces null (the void transform).