zoukankan      html  css  js  c++  java
  • 2- 获取类的方法以及变量

    获取类的方法以及变量

    • getMethods 获取默认方法,包括父类Object的

    mark

    public java.lang.String com.xieth.jdkeight.domain.Person.toString()
    public java.lang.String com.xieth.jdkeight.domain.Person.getName()
    public void com.xieth.jdkeight.domain.Person.setName(java.lang.String)
    public void com.xieth.jdkeight.domain.Person.setAge(int)
    public int com.xieth.jdkeight.domain.Person.getAge()
    public java.lang.String com.xieth.jdkeight.domain.Person.getStr()
    public void com.xieth.jdkeight.domain.Person.sao()
    public void com.xieth.jdkeight.domain.Person.sao(java.lang.String)
    public void com.xieth.jdkeight.domain.Person.setStr(java.lang.String)
    public final void java.lang.Object.wait() throws java.lang.InterruptedException
    public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException
    public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
    public boolean java.lang.Object.equals(java.lang.Object)
    public native int java.lang.Object.hashCode()
    public final native java.lang.Class java.lang.Object.getClass()
    public final native void java.lang.Object.notify()
    public final native void java.lang.Object.notifyAll()
    
    • getDeclaredMethods获取自身的方法,不包括父类的

    mark

    public java.lang.String com.xieth.jdkeight.domain.Person.toString()
    public java.lang.String com.xieth.jdkeight.domain.Person.getName()
    public void com.xieth.jdkeight.domain.Person.setName(java.lang.String)
    public int com.xieth.jdkeight.domain.Person.getAge()
    public void com.xieth.jdkeight.domain.Person.sao()
    public void com.xieth.jdkeight.domain.Person.sao(java.lang.String)
    public java.lang.String com.xieth.jdkeight.domain.Person.getStr()
    public void com.xieth.jdkeight.domain.Person.setAge(int)
    public void com.xieth.jdkeight.domain.Person.setStr(java.lang.String)
    
    • getFields 获取public级别的变量,设置值并输出

    mark

    collect = [public java.lang.String com.xieth.jdkeight.domain.Person.str]
    obj = sss
    
    • getDeclaredFields 获取所有变量

    mark

    collect = [private java.lang.String com.xieth.jdkeight.domain.Person.name, public java.lang.String com.xieth.jdkeight.domain.Person.str]
    obj = sss
    obj = sss
    
  • 相关阅读:
    一次router拦截器的应用
    node中的koa2
    node中从express到koa再到koa2的发展历程
    node中的crypto内置模块
    node中的http内置模块
    node中的stream(流)内置模块
    node中fs内置模块
    node 中的global对象和process对象
    CSS命名规范
    作品展示
  • 原文地址:https://www.cnblogs.com/xietianhua/p/11342564.html
Copyright © 2011-2022 走看看