Class Utils


  • public class Utils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String converToInnerClassName​(java.lang.String className)
      Convert class name to a format that can be used as part of inner class name by replacing all '.'s with '$'s.
      static java.lang.ClassLoader getAgentClassLoader()
      Return the classloader the core agent is running on.
      static io.opentelemetry.javaagent.bootstrap.AgentClassLoader.BootstrapClassLoaderProxy getBootstrapProxy()
      Return a classloader which can be used to look up bootstrap resources.
      static java.lang.String getClassName​(java.lang.String resourceName)
      com/foo/Bar.class to com.foo.Bar
      static java.lang.String getInternalName​(java.lang.String resourceName)
      com.foo.Bar to com/foo/Bar
      static net.bytebuddy.description.method.MethodDescription getMethodDefinition​(net.bytebuddy.description.type.TypeDefinition type, java.lang.String methodName)
      Get method definition for given TypeDefinition and method name.
      static java.lang.String getResourceName​(java.lang.String className)
      com.foo.Bar to com/foo/Bar.class
      static java.lang.String getStackTraceAsString()
      Returns the current stack trace with multiple entries on new lines.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getAgentClassLoader

        public static java.lang.ClassLoader getAgentClassLoader()
        Return the classloader the core agent is running on.
      • getBootstrapProxy

        public static io.opentelemetry.javaagent.bootstrap.AgentClassLoader.BootstrapClassLoaderProxy getBootstrapProxy()
        Return a classloader which can be used to look up bootstrap resources.
      • getResourceName

        public static java.lang.String getResourceName​(java.lang.String className)
        com.foo.Bar to com/foo/Bar.class
      • getClassName

        public static java.lang.String getClassName​(java.lang.String resourceName)
        com/foo/Bar.class to com.foo.Bar
      • getInternalName

        public static java.lang.String getInternalName​(java.lang.String resourceName)
        com.foo.Bar to com/foo/Bar
      • converToInnerClassName

        public static java.lang.String converToInnerClassName​(java.lang.String className)
        Convert class name to a format that can be used as part of inner class name by replacing all '.'s with '$'s.
        Parameters:
        className - class named to be converted
        Returns:
        convertd name
      • getMethodDefinition

        public static net.bytebuddy.description.method.MethodDescription getMethodDefinition​(net.bytebuddy.description.type.TypeDefinition type,
                                                                                             java.lang.String methodName)
        Get method definition for given TypeDefinition and method name.
        Parameters:
        type - type
        methodName - method name
        Returns:
        MethodDescription for given method
        Throws:
        java.lang.IllegalStateException - if more then one method matches (i.e. in case of overloaded methods) or if no method found
      • getStackTraceAsString

        public static java.lang.String getStackTraceAsString()
        Returns the current stack trace with multiple entries on new lines.