Class AbstractExceptions


  • public abstract class AbstractExceptions
    extends java.lang.Object

    Abstract class that includes common variables and methods for different Exceptions implementations.

    Since:
    0.1.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int appendStackTraceGroupElement​(java.lang.StringBuilder stringBuilder, java.lang.String currentGroupPackage, int numberOfElementsInTheCurrentGroup, java.lang.StackTraceElement firstStackTraceElementInTheGroup, boolean printPackageInformation)
      Appends stack trace group information for the given parameters.
      static void clearGroupPackages()
      Clears previously registered group packages.
      static void clearIgnorePackages()
      Clears previously registered ignore packages.
      static void clearRootPackages()
      Clears previously registered root packages.
      static boolean containsCause​(java.lang.Throwable throwable, java.lang.Class<?> causeClass)
      Returns true if the given cause class is found in the exception chain of the throwable.
      static boolean containsCause​(java.lang.Throwable throwable, java.lang.Class<?> causeClass, java.lang.String causeMessage)
      Returns true if the given cause class and cause message is found in the exception chain of the throwable.
      static boolean containsPackage​(java.lang.String fullClassName, java.util.Set<java.lang.String> packageSet)
      Returns true if package of the given class name matches one of package names provided in packageSet.
      static java.lang.String getAllMessages​(java.lang.Throwable throwable)
      Returns all messages found in the exception chain of the throwable as a single string.
      static void getAllMessages​(java.lang.Throwable throwable, java.lang.StringBuilder messageBuilder)
      Adds all messages found in the exception chain of the throwable into the given message builder.
      static java.lang.Throwable getCause​(java.lang.Throwable throwable)
      Returns the cause of the throwable by walking through the exception chain.
      static java.lang.Throwable getCause​(java.lang.Throwable throwable, int maxDepth)
      Returns the cause of the throwable by walking through the exception chain.
      static java.lang.String getContainingPackage​(java.lang.String fullClassName, java.util.Set<java.lang.String> packageSet)
      Checks if one of the package names in the packageSet matches the package of the given class name and returns the matching package name.
      static boolean getIgnoreAllCauses()
      Returns the value of ignore all causes option.
      static java.lang.StackTraceElement[] getStackTrace​(java.lang.Throwable throwable, int maxDepth)
      Builds a smart stack trace for the given throwable using elements found until the maxDepth and elements of it.
      static java.lang.StackTraceElement[] getStackTrace​(java.lang.Throwable throwable, java.util.Set<java.lang.String> rootPackageSet, java.util.Set<java.lang.String> ignorePackageSet)
      Builds a smart stack trace for the given throwable using packages provided and returns elements of it.
      static StackTraceElementSerializer getStackTraceElementSerializer()
      Returns the global stack trace serializer implementation which is used to serialize StackTraceElement objects in getStackTraceString methods.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable)
      Returns the smart stack trace for the given throwable.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, boolean ignoreAllCauses)
      Returns the smart stack trace for the given throwable.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, boolean isCause, java.util.Set<java.lang.String> rootPackageSet, java.util.Set<java.lang.String> groupPackageSet, java.util.Set<java.lang.String> ignorePackageSet, int maxDepth, boolean ignoreAllCauses, boolean printPackageInformation)
      Returns the smart stack trace for the given throwable using parameters provided.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, int maxDepth)
      Returns the smart stack trace for the given throwable using elements found until the maxDepth.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, int maxDepth, boolean ignoreAllCauses)
      Returns the smart stack trace for the given throwable using elements found until the maxDepth.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, int maxDepth, boolean ignoreAllCauses, boolean printPackageInformation)
      Returns the smart stack trace for the given throwable using elements found until the maxDepth.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, java.lang.String rootPackage)
      Returns the smart stack trace for the given throwable using root package provided.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, java.lang.String rootPackage, java.lang.String groupPackage)
      Returns the smart stack trace for the given throwable using root package provided.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, java.util.Set<java.lang.String> rootPackageSet, java.util.Set<java.lang.String> groupPackageSet, java.util.Set<java.lang.String> ignorePackageSet)
      Returns the smart stack trace for the given throwable using packages provided.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, java.util.Set<java.lang.String> rootPackageSet, java.util.Set<java.lang.String> groupPackageSet, java.util.Set<java.lang.String> ignorePackageSet, boolean ignoreAllCauses)
      Returns the smart stack trace for the given throwable using packages provided.
      static java.lang.String getStackTraceString​(java.lang.Throwable throwable, java.util.Set<java.lang.String> rootPackageSet, java.util.Set<java.lang.String> groupPackageSet, java.util.Set<java.lang.String> ignorePackageSet, boolean ignoreAllCauses, boolean printPackageInformation)
      Returns the smart stack trace for the given throwable using packages provided.
      static java.lang.String getVersion​(PackageLoader packageLoader, java.lang.Class<?> type, java.lang.String packageName)
      Loads the implementation version for the given package.
      static boolean isEmpty​(java.lang.String value)
      Checks if given string is empty or not.
      static boolean isPrintPackageInformation()
      Returns the value of print package information option.
      static java.lang.String libraryName​(java.lang.Class<?> type)
      Returns the jar file that includes the given class.
      static java.lang.String packageName​(java.lang.String className)
      Returns the package name of this class.
      static void registerGroupPackage​(java.lang.String packageString)
      Registers a new group package.
      static void registerIgnorePackage​(java.lang.String packageString, boolean ignoreCauseClasses)
      Registers a new ignore package.
      static void registerRootPackage​(java.lang.String packageString)
      Registers a new root package.
      static java.lang.Throwable searchCause​(java.lang.Throwable throwable, java.lang.Class<?> causeClass)
      Searches for the given cause class in the exception chain of the throwable.
      static java.lang.Throwable searchCause​(java.lang.Throwable throwable, java.lang.Class<?> causeClass, int maxDepth)
      Searches for the given cause class in the exception chain of the throwable.
      static java.lang.Throwable searchCause​(java.lang.Throwable throwable, java.lang.Class<?> causeClass, java.lang.String causeMessage)
      Searches for the given cause class and cause message in the exception chain of the throwable.
      static java.lang.Throwable searchCause​(java.lang.Throwable throwable, java.lang.Class<?> causeClass, java.lang.String causeMessage, int maxDepth)
      Searches for the given cause class and cause message in the exception chain of the throwable.
      static void setIgnoreAllCauses​(boolean ignoreAllCauses)
      Sets the value of ignore all causes option.
      static void setPrintPackageInformation​(boolean printPackageInformation)
      Sets the value of print package information option.
      static void setStackTraceElementSerializer​(StackTraceElementSerializer stackTraceElementSerializer)
      Sets the global stack trace serializer implementation which is used to serialize StackTraceElement objects in getStackTraceString methods.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_MAX_DEPTH

        public static final int DEFAULT_MAX_DEPTH

        Default max depth used in methods which do not have a maxDepth argument.

        See Also:
        Constant Field Values
      • DEFAULT_IGNORE_ALL_CAUSES

        public static final boolean DEFAULT_IGNORE_ALL_CAUSES

        Default value for ignoring all causes when stack trace elements are printed or converted to string.

        See Also:
        Constant Field Values
      • DEFAULT_PRINT_PACKAGE_INFORMATION

        public static final boolean DEFAULT_PRINT_PACKAGE_INFORMATION

        Default value for printing package information when stack trace elements are printed or converted to string.

        See Also:
        Constant Field Values
      • rootPackageSet

        public static final java.util.Set<java.lang.String> rootPackageSet

        Stores global root package names.

      • groupPackageSet

        public static final java.util.Set<java.lang.String> groupPackageSet

        Stores global group package names.

      • ignorePackageSet

        public static final java.util.Set<java.lang.String> ignorePackageSet

        Stores global ignore package names.

      • ignoreCausePackageSet

        public static final java.util.Set<java.lang.String> ignoreCausePackageSet

        Stores global ignore cause package names.

      • ignoreAllCauses

        public static boolean ignoreAllCauses

        Stores the value of global ignore all causes option.

      • stackTraceElementSerializer

        public static StackTraceElementSerializer stackTraceElementSerializer

        Stores the global stack trace serializer implementation.

      • printPackageInformation

        public static boolean printPackageInformation

        Stores the global print package information option.

    • Constructor Detail

      • AbstractExceptions

        public AbstractExceptions()
    • Method Detail

      • registerRootPackage

        public static void registerRootPackage​(java.lang.String packageString)

        Registers a new root package.

        Parameters:
        packageString - root package name to register
      • clearRootPackages

        public static void clearRootPackages()

        Clears previously registered root packages.

      • registerGroupPackage

        public static void registerGroupPackage​(java.lang.String packageString)

        Registers a new group package.

        Parameters:
        packageString - group package name to register
      • clearGroupPackages

        public static void clearGroupPackages()

        Clears previously registered group packages.

      • getStackTraceElementSerializer

        public static StackTraceElementSerializer getStackTraceElementSerializer()

        Returns the global stack trace serializer implementation which is used to serialize StackTraceElement objects in getStackTraceString methods.

        Returns:
        current stack trace serializer implementation
      • setStackTraceElementSerializer

        public static void setStackTraceElementSerializer​(StackTraceElementSerializer stackTraceElementSerializer)

        Sets the global stack trace serializer implementation which is used to serialize StackTraceElement objects in getStackTraceString methods.

        Parameters:
        stackTraceElementSerializer - new stack trace serializer implementation
      • registerIgnorePackage

        public static void registerIgnorePackage​(java.lang.String packageString,
                                                 boolean ignoreCauseClasses)

        Registers a new ignore package.

        Parameters:
        packageString - ignore package name to register
        ignoreCauseClasses - ignore cause classes from this package too
      • clearIgnorePackages

        public static void clearIgnorePackages()

        Clears previously registered ignore packages.

      • getIgnoreAllCauses

        public static boolean getIgnoreAllCauses()

        Returns the value of ignore all causes option.

        Returns:
        the value of global ignore all causes option. If value is true then stack trace elements printed or converted to string will not include causes. If value is false causes will be appended to the stack trace of the main throwable.
      • setIgnoreAllCauses

        public static void setIgnoreAllCauses​(boolean ignoreAllCauses)

        Sets the value of ignore all causes option.

        Parameters:
        ignoreAllCauses - new global ignore all causes option. If value is true then stack trace elements printed or converted to string will not include causes. If value is false causes will be appended to the stack trace of the main throwable.
      • isPrintPackageInformation

        public static boolean isPrintPackageInformation()

        Returns the value of print package information option.

        Returns:
        the value of global print package information option. When this option is true, stack trace elements printed or converted to string will include the name of the jar file that includes the printed class and the version of the jar. If it is false, none of this information is printed
      • setPrintPackageInformation

        public static void setPrintPackageInformation​(boolean printPackageInformation)

        Sets the value of print package information option.

        When this option is true, stack trace elements printed or converted to string will include the name of the jar file that includes the printed class and the version of the jar.

        Note that for some libraries extracting the jar file and the version may not be possible.

        Parameters:
        printPackageInformation - new print package information option.
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable)

        Returns the smart stack trace for the given throwable.

        This method uses root packages registered by registerRootPackage(String), group packages registered by registerGroupPackage(String) and ignore packages registered by registerIgnorePackage(String, boolean) to build the smart stack trace.

        Parameters:
        throwable - parent throwable
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           boolean ignoreAllCauses)

        Returns the smart stack trace for the given throwable.

        This method uses root packages registered by registerRootPackage(String), group packages registered by registerGroupPackage(String) and ignore packages registered by registerIgnorePackage(String, boolean) to build the smart stack trace.

        Parameters:
        throwable - parent throwable
        ignoreAllCauses - ignore all causes in the exception chain
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           java.util.Set<java.lang.String> rootPackageSet,
                                                           java.util.Set<java.lang.String> groupPackageSet,
                                                           java.util.Set<java.lang.String> ignorePackageSet)

        Returns the smart stack trace for the given throwable using packages provided.

        Parameters:
        throwable - parent throwable
        rootPackageSet - root packages to use for building the stack trace
        groupPackageSet - group packages to use for building the stack trace
        ignorePackageSet - ignore packages to use for building the stack trace
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           java.util.Set<java.lang.String> rootPackageSet,
                                                           java.util.Set<java.lang.String> groupPackageSet,
                                                           java.util.Set<java.lang.String> ignorePackageSet,
                                                           boolean ignoreAllCauses)

        Returns the smart stack trace for the given throwable using packages provided.

        Parameters:
        throwable - parent throwable
        rootPackageSet - root packages to use for building the stack trace
        groupPackageSet - group packages to use for building the stack trace
        ignorePackageSet - ignore packages to use for building the stack trace
        ignoreAllCauses - ignore all causes in the exception chain
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           java.util.Set<java.lang.String> rootPackageSet,
                                                           java.util.Set<java.lang.String> groupPackageSet,
                                                           java.util.Set<java.lang.String> ignorePackageSet,
                                                           boolean ignoreAllCauses,
                                                           boolean printPackageInformation)

        Returns the smart stack trace for the given throwable using packages provided.

        Parameters:
        throwable - parent throwable
        rootPackageSet - root packages to use for building the stack trace
        groupPackageSet - group packages to use for building the stack trace
        ignorePackageSet - ignore packages to use for building the stack trace
        ignoreAllCauses - ignore all causes in the exception chain
        printPackageInformation - print package information
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           java.lang.String rootPackage)

        Returns the smart stack trace for the given throwable using root package provided.

        Parameters:
        throwable - parent throwable
        rootPackage - root package to use for building the stack trace
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           java.lang.String rootPackage,
                                                           java.lang.String groupPackage)

        Returns the smart stack trace for the given throwable using root package provided.

        Parameters:
        throwable - parent throwable
        rootPackage - root package to use for building the stack trace
        groupPackage - group package to use for building the stack trace
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           int maxDepth)

        Returns the smart stack trace for the given throwable using elements found until the maxDepth.

        Parameters:
        throwable - parent throwable
        maxDepth - max depth in exception chain that will be used
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           int maxDepth,
                                                           boolean ignoreAllCauses)

        Returns the smart stack trace for the given throwable using elements found until the maxDepth.

        Parameters:
        throwable - parent throwable
        maxDepth - max depth in exception chain that will be used
        ignoreAllCauses - ignore all causes in the exception chain
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           int maxDepth,
                                                           boolean ignoreAllCauses,
                                                           boolean printPackageInformation)

        Returns the smart stack trace for the given throwable using elements found until the maxDepth.

        Parameters:
        throwable - parent throwable
        maxDepth - max depth in exception chain that will be used
        ignoreAllCauses - ignore all causes in the exception chain
        printPackageInformation - print package information
        Returns:
        a string containing the smart stack trace for the given throwable
      • getStackTraceString

        public static java.lang.String getStackTraceString​(java.lang.Throwable throwable,
                                                           boolean isCause,
                                                           java.util.Set<java.lang.String> rootPackageSet,
                                                           java.util.Set<java.lang.String> groupPackageSet,
                                                           java.util.Set<java.lang.String> ignorePackageSet,
                                                           int maxDepth,
                                                           boolean ignoreAllCauses,
                                                           boolean printPackageInformation)

        Returns the smart stack trace for the given throwable using parameters provided.

        Parameters:
        throwable - parent throwable
        isCause - throwable is a cause or not
        rootPackageSet - root packages to use for building the stack trace
        groupPackageSet - group packages to use for building the stack trace
        ignorePackageSet - ignore packages to use for building the stack trace
        maxDepth - max depth in exception chain that will be used
        ignoreAllCauses - ignore all causes in the exception chain
        printPackageInformation - print package information
        Returns:
        a string containing the smart stack trace for the given throwable
      • appendStackTraceGroupElement

        public static int appendStackTraceGroupElement​(java.lang.StringBuilder stringBuilder,
                                                       java.lang.String currentGroupPackage,
                                                       int numberOfElementsInTheCurrentGroup,
                                                       java.lang.StackTraceElement firstStackTraceElementInTheGroup,
                                                       boolean printPackageInformation)

        Appends stack trace group information for the given parameters.

        Parameters:
        stringBuilder - string builder that group stack trace information will be appended
        currentGroupPackage - package name of the current group
        numberOfElementsInTheCurrentGroup - number of elements in the current group
        firstStackTraceElementInTheGroup - first stack trace element of this group
        printPackageInformation - print package information
        Returns:
        new value for the group element count
      • containsPackage

        public static boolean containsPackage​(java.lang.String fullClassName,
                                              java.util.Set<java.lang.String> packageSet)

        Returns true if package of the given class name matches one of package names provided in packageSet.

        Parameters:
        fullClassName - fully qualified class name
        packageSet - set containing package names
        Returns:
        true if package of the given class name matches one of package names provided in packageSet, false otherwise
      • getContainingPackage

        public static java.lang.String getContainingPackage​(java.lang.String fullClassName,
                                                            java.util.Set<java.lang.String> packageSet)

        Checks if one of the package names in the packageSet matches the package of the given class name and returns the matching package name.

        Parameters:
        fullClassName - fully qualified class name
        packageSet - set containing package names
        Returns:
        one of the package names in the packageSet that matches the package of the given class name or null if no matching package name is found in the packageSet
      • getAllMessages

        public static java.lang.String getAllMessages​(java.lang.Throwable throwable)

        Returns all messages found in the exception chain of the throwable as a single string.

        Parameters:
        throwable - parent throwable
        Returns:
        a string containing all messages found in the exception chain
      • getAllMessages

        public static void getAllMessages​(java.lang.Throwable throwable,
                                          java.lang.StringBuilder messageBuilder)

        Adds all messages found in the exception chain of the throwable into the given message builder.

        Parameters:
        throwable - parent throwable
        messageBuilder - message builder
      • getStackTrace

        public static java.lang.StackTraceElement[] getStackTrace​(java.lang.Throwable throwable,
                                                                  int maxDepth)

        Builds a smart stack trace for the given throwable using elements found until the maxDepth and elements of it.

        Parameters:
        throwable - parent throwable
        maxDepth - max depth in exception chain that will be returned
        Returns:
        an array containing stack trace elements
      • getStackTrace

        public static java.lang.StackTraceElement[] getStackTrace​(java.lang.Throwable throwable,
                                                                  java.util.Set<java.lang.String> rootPackageSet,
                                                                  java.util.Set<java.lang.String> ignorePackageSet)

        Builds a smart stack trace for the given throwable using packages provided and returns elements of it.

        Parameters:
        throwable - parent throwable
        rootPackageSet - root packages to use for building the stack trace
        ignorePackageSet - ignore packages to use for building the stack trace
        Returns:
        an array containing stack trace elements
      • containsCause

        public static boolean containsCause​(java.lang.Throwable throwable,
                                            java.lang.Class<?> causeClass)

        Returns true if the given cause class is found in the exception chain of the throwable.

        Search starts from the throwable itself and goes through the exception chain up until DEFAULT_MAX_DEPTH.

        Parameters:
        throwable - parent throwable
        causeClass - class to search for
        Returns:
        true if the given cause class is found in the exception chain of the throwable, false otherwise
      • containsCause

        public static boolean containsCause​(java.lang.Throwable throwable,
                                            java.lang.Class<?> causeClass,
                                            java.lang.String causeMessage)

        Returns true if the given cause class and cause message is found in the exception chain of the throwable.

        Search starts from the throwable itself and goes through the exception chain up until DEFAULT_MAX_DEPTH.

        Parameters:
        throwable - parent throwable
        causeClass - class to search for
        causeMessage - message to search for
        Returns:
        true if the given cause class and cause message is found in the exception chain of the throwable, false otherwise
      • getCause

        public static java.lang.Throwable getCause​(java.lang.Throwable throwable)

        Returns the cause of the throwable by walking through the exception chain.

        Parameters:
        throwable - parent throwable
        Returns:
        the cause of the throwable found or null if throwable does not have a cause
      • getCause

        public static java.lang.Throwable getCause​(java.lang.Throwable throwable,
                                                   int maxDepth)

        Returns the cause of the throwable by walking through the exception chain.

        Note that this method walks through the exception chain up to given maxDepth. If exception chain includes more items than maxDepth, cause found at maxDepth level is returned.

        Parameters:
        throwable - parent throwable
        maxDepth - max depth in exception chain that will be searched
        Returns:
        the cause of the throwable found until maxDepth is reached in the exception chain or null if throwable does not have a cause
      • searchCause

        public static java.lang.Throwable searchCause​(java.lang.Throwable throwable,
                                                      java.lang.Class<?> causeClass)

        Searches for the given cause class in the exception chain of the throwable.

        Search starts from the throwable itself and goes through the exception chain up until DEFAULT_MAX_DEPTH.

        Parameters:
        throwable - parent throwable
        causeClass - class to search for
        Returns:
        the throwable found or null if no class in exception chain matches the given cause class
      • searchCause

        public static java.lang.Throwable searchCause​(java.lang.Throwable throwable,
                                                      java.lang.Class<?> causeClass,
                                                      java.lang.String causeMessage)

        Searches for the given cause class and cause message in the exception chain of the throwable.

        Search starts from the throwable itself and goes through the exception chain up until DEFAULT_MAX_DEPTH.

        Parameters:
        throwable - parent throwable
        causeClass - class to search for
        causeMessage - message to search for
        Returns:
        the throwable found or null if no class in exception chain matches the given cause class and cause message
      • searchCause

        public static java.lang.Throwable searchCause​(java.lang.Throwable throwable,
                                                      java.lang.Class<?> causeClass,
                                                      java.lang.String causeMessage,
                                                      int maxDepth)

        Searches for the given cause class and cause message in the exception chain of the throwable.

        Search starts from the throwable itself and goes through the exception chain up until the given maxDepth.

        Parameters:
        throwable - parent throwable
        causeClass - class to search for
        causeMessage - message to search for
        maxDepth - max depth in exception chain that will be searched
        Returns:
        the throwable found or null if no class in exception chain matches the given cause class and cause message
      • searchCause

        public static java.lang.Throwable searchCause​(java.lang.Throwable throwable,
                                                      java.lang.Class<?> causeClass,
                                                      int maxDepth)

        Searches for the given cause class in the exception chain of the throwable.

        Search starts from the throwable itself and goes through the exception chain up until the given maxDepth.

        Parameters:
        throwable - parent throwable
        causeClass - class to search for
        maxDepth - max depth in exception chain that will be searched
        Returns:
        the throwable found or null if no class in exception chain matches the given cause class
      • isEmpty

        public static boolean isEmpty​(java.lang.String value)

        Checks if given string is empty or not.

        Parameters:
        value - string to check
        Returns:
        true if given string is null or has zero length after trim(), false otherwise
      • packageName

        public static java.lang.String packageName​(java.lang.String className)

        Returns the package name of this class.

        Parameters:
        className - fully qualified class name
        Returns:
        name of the package
      • getVersion

        public static java.lang.String getVersion​(PackageLoader packageLoader,
                                                  java.lang.Class<?> type,
                                                  java.lang.String packageName)
        Loads the implementation version for the given package.
        Parameters:
        packageLoader - package loader
        type - class
        packageName - package
        Returns:
        implementation version specified for the given package or null if a version is not specified
      • libraryName

        public static java.lang.String libraryName​(java.lang.Class<?> type)
        Returns the jar file that includes the given class.
        Parameters:
        type - class
        Returns:
        name of the jar file that includes the class or null if jar file information cannot be found