zoukankan      html  css  js  c++  java
  • StackTraceElement 源码阅读

    StackTraceElement

    • 属性说明
    /**
     *  每个 StackTraceElement 对象代表一个独立的栈帧,所有栈帧的顶部是一个方法调用
     * @since  1.4
     * @author Josh Bloch
     */
    public final class StackTraceElement implements java.io.Serializable {
        /**
         *  For Throwables and StackWalker, the VM initially sets this field to a
         *  reference to the declaring Class.  The Class reference is used to
         *  construct the 'format' bitmap, and then is cleared.
         *  For STEs constructed using the public constructors, this field is not used.
         */
        private transient Class<?> declaringClassObject;
    
        // 通常由 JVM 初始化
        /**
         *  类加载器的名称
         */
        private String classLoaderName;
        /**
         *  模块名称
         */
        private String moduleName;
        /**
         *  模块版本
         */
        private String moduleVersion;
        /**
         *  方法声明的类
         */
        private String declaringClass;
        /**
         *  方法名称
         */
        private String methodName;
        /**
         *  文件名称
         */
        private String fileName;
        /**
         *  行号
         */
        private int    lineNumber;
        private byte   format = 0; // Default to show all
    
    • 常用方法
        /**
         *  获取目标类的全限定类名
         */
        public String getClassName() {
            return declaringClass;
        }
    
        /**
         *  获取目标方法名称
         */
        public String getMethodName() {
            return methodName;
        }
    
        /**
         *  获取源文件的执行行号
         */
        public int getLineNumber() {
            return lineNumber;
        }
    
  • 相关阅读:
    LAMP的搭建
    linux利用命令重置大量密码
    CSS的应用下
    Day13 CSS的与应用
    Day12 CSS简单用法
    Day12 前端html
    Day11 数据库的基本语法(偏重于查询)
    Java-->把txt中的所有字符按照码表值排序
    Java-->将txt文件的所有行反转
    Java-->在txt文件每一行前加行数和冒号
  • 原文地址:https://www.cnblogs.com/zhuxudong/p/10502181.html
Copyright © 2011-2022 走看看