Class SStackTraceElementHelper


  • public class SStackTraceElementHelper
    extends java.lang.Object
    Helper for reading stacktrace elements in both Java 9 and legacy Java.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.invoke.MethodHandle constructor
      Legacy constructor.
      protected static java.lang.invoke.MethodHandle constructor9
      Java 9+ constructor if available.
      protected static java.lang.invoke.MethodHandle getclassloadername
      Java 9+ method if available.
      protected static java.lang.invoke.MethodHandle getmodulename
      Java 9+ method if available.
      protected static java.lang.invoke.MethodHandle getmoduleversion
      Java 9+ method if available.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getClassLoaderName​(java.lang.StackTraceElement ste)
      Returns the name of the class loader.
      static java.lang.String getModuleName​(java.lang.StackTraceElement ste)
      Returns the module name.
      static java.lang.String getModuleVersion​(java.lang.StackTraceElement ste)
      Returns the module version.
      static boolean hasJava9()
      Check for Java 9+
      static java.lang.StackTraceElement newInstance​(java.lang.String classloadername, java.lang.String modulename, java.lang.String moduleversion, java.lang.String classname, java.lang.String methodname, java.lang.String filename, int linenumber)
      Creates a new instance based on Java version capability.
      • Methods inherited from class java.lang.Object

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

      • constructor

        protected static java.lang.invoke.MethodHandle constructor
        Legacy constructor.
      • constructor9

        protected static java.lang.invoke.MethodHandle constructor9
        Java 9+ constructor if available.
      • getclassloadername

        protected static java.lang.invoke.MethodHandle getclassloadername
        Java 9+ method if available.
      • getmodulename

        protected static java.lang.invoke.MethodHandle getmodulename
        Java 9+ method if available.
      • getmoduleversion

        protected static java.lang.invoke.MethodHandle getmoduleversion
        Java 9+ method if available.
    • Constructor Detail

      • SStackTraceElementHelper

        public SStackTraceElementHelper()
    • Method Detail

      • newInstance

        public static java.lang.StackTraceElement newInstance​(java.lang.String classloadername,
                                                              java.lang.String modulename,
                                                              java.lang.String moduleversion,
                                                              java.lang.String classname,
                                                              java.lang.String methodname,
                                                              java.lang.String filename,
                                                              int linenumber)
        Creates a new instance based on Java version capability.
        Returns:
        StackTraceElement.
      • getModuleName

        public static java.lang.String getModuleName​(java.lang.StackTraceElement ste)
        Returns the module name.
      • getModuleVersion

        public static java.lang.String getModuleVersion​(java.lang.StackTraceElement ste)
        Returns the module version.
      • getClassLoaderName

        public static java.lang.String getClassLoaderName​(java.lang.StackTraceElement ste)
        Returns the name of the class loader.
      • hasJava9

        public static boolean hasJava9()
        Check for Java 9+
        Returns:
        True if Java9+.