Class LabelUtil


  • public final class LabelUtil
    extends Object
    Miscellaneous utilities for obtaining model labels for UI-related purposes.
    Restriction:
    This class is not intended to be sub-classed by clients.
    Restriction:
    This class is not intended to be instantiated by clients.
    • Method Detail

      • getLabel

        public static String getLabel​(Object object)
        Obtains label for a given object.
        Parameters:
        object - the object to obtain label for, cannot be null
        Returns:
        obtained label or empty string if object has no label, never null
      • getPath

        public static String getPath​(Object object,
                                     String pathSeparator)
        Obtains path string for a given object.
        Parameters:
        object - the object to obtain path for, cannot be null
        pathSeparator - the path separator to use, cannot be null
        Returns:
        obtained path or empty string if object has no path, never null
      • getPath

        public static String getPath​(Object object,
                                     String pathSeparator,
                                     Class<?> stopAfter)
        Obtains path string for a given object.
        Parameters:
        object - the object to obtain path for, cannot be null
        pathSeparator - the path separator to use, cannot be null
        stopAfter - path generation will be stopped after object of this class is encountered among parents or null if not needed
        Returns:
        obtained path or empty string if object has no path, never null
      • getPath

        public static String getPath​(Object object,
                                     String pathSeparator,
                                     Class<?> stopAfter,
                                     int fromIndex)
        Obtains path string for a given object.
        Parameters:
        object - the object to obtain path for, cannot be null
        pathSeparator - the path separator to use, cannot be null
        stopAfter - path generation will be stopped after object of this class is encountered among parents or null if not needed
        fromIndex - the index of the occurrence of the stopAfter to use to stop, must be positive
        Returns:
        obtained path or empty string if object has no path, never null
      • getPath

        public static String getPath​(Object object,
                                     String pathSeparator,
                                     Class<?> stopAfter,
                                     int fromIndex,
                                     Predicate<Object> filter)
        Obtains path string for a given object.
        Parameters:
        object - the object to obtain path for, cannot be null
        pathSeparator - the path separator to use, cannot be null
        stopAfter - path generation will be stopped after object of this class is encountered among parents or null if not needed
        fromIndex - the index of the occurrence of the stopAfter to use to stop, must be positive
        filter - whether need to skip objects and don't add to result path, separator will aslo be skipped, can be null if not needed; filter will be applied to each path element
        Returns:
        obtained path or empty string if object has no path.