public static void main(String[] args) throws IntrospectionException {
    BeanInfo beanInfo = Introspector.getBeanInfo(User.class);

    System.out.println("==>MethodDescriptor");
    MethodDescriptor[] methodDescs = beanInfo.getMethodDescriptors();
    for (MethodDescriptor method : methodDescs) {
      System.out.println(method.getName());
      System.out.println(method.getDisplayName());
      System.out.println(method.getShortDescription());
      System.out.println(method.getValue("getName"));

      System.out.println("==>MethodDescriptor/ReflectionMethod");
      Method reflectMethod = method.getMethod();
      System.out.println(reflectMethod.getName());

      System.out.println("==>MethodDescriptor/ParameterDescriptor");
      ParameterDescriptor[] paramDescs = method.getParameterDescriptors();
      if (paramDescs != null) {
        for (ParameterDescriptor paramDesc : paramDescs) {
          System.out.println(paramDesc.getName());
          System.out.println(paramDesc.getDisplayName());
          System.out.println(paramDesc.getShortDescription());
          System.out.println(paramDesc.getValue("name"));
        }
      }
    }
  }
Esempio n. 2
0
    private ParameterInfo(ResourceInfo.MethodInfo info, int idx, ParameterDescriptor old) {
      this.info = info;
      this.idx = idx;
      setExpert(old.isExpert());
      setHidden(old.isHidden());
      setPreferred(old.isPreferred());
      setName(old.getName());
      setShortDescription(old.getShortDescription());
      setDisplayName(old.getDisplayName());

      Enumeration<String> names = old.attributeNames();
      while (names.hasMoreElements()) {
        String name = names.nextElement();
        setValue(name, old.getValue(name));
      }
    }