Class Utils


  • @Internal
    public final class Utils
    extends Object
    Utility class that contains helper methods to work with Java APIs.
    • Field Detail

      • RNG

        public static final Random RNG
    • Method Detail

      • getCallLocationName

        public static String getCallLocationName()
      • getCallLocationName

        public static String getCallLocationName​(int depth)
      • getSerializerTree

        public static <T> String getSerializerTree​(TypeInformation<T> ti)
        Debugging utility to understand the hierarchy of serializers created by the Java API. Tested in GroupReduceITCase.testGroupByGenericType()
      • resolveFactory

        public static <T> Optional<T> resolveFactory​(ThreadLocal<T> threadLocalFactory,
                                                     @Nullable
                                                     T staticFactory)
        Resolves the given factories. The thread local factory has preference over the static factory. If none is set, the method returns Optional.empty().
        Type Parameters:
        T - type of factory
        Parameters:
        threadLocalFactory - containing the thread local factory
        staticFactory - containing the global factory
        Returns:
        Optional containing the resolved factory if it exists, otherwise it's empty
      • getKeyFromArgs

        public static String getKeyFromArgs​(String[] args,
                                            int index)
        Get the key from the given args. Keys have to start with '-' or '--'. For example, --key1 value1 -key2 value2.
        Parameters:
        args - all given args.
        index - the index of args to be parsed.
        Returns:
        the key of the given arg.