ArthurDn

Untitled

Oct 11th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. import java.lang.reflect.Field;
  2. import java.lang.reflect.Method;
  3.  
  4. class TestClass {
  5.     private int value;
  6.     public String sa;
  7.    
  8.     public int getValue() { return value; }
  9.     public void setValue(int valueIn) { this.value = valueIn; }
  10. }
  11.  
  12. public class SimpleComponent {
  13.  
  14.     public static void main(String[] args) {
  15.         TestClass testClass = new TestClass();
  16.         Object o=new Object();
  17.         char c[]=new char[6];
  18.         for (Field field: testClass.getClass().getDeclaredFields()) {
  19.             System.out.printf("name: %s, type: %s \n", field.getName(),"2");
  20.            
  21.         }
  22.         testClass.getClass().getField("sa").getType().getCanonicalName().toString().getChars(10, 15, c, 0);
  23.         System.out.println(c);
  24.         for (Method method : testClass.getClass().getDeclaredMethods()) {
  25.             System.out.printf("name: %s, return type: %s  \n", method.getName(), method.getReturnType().getCanonicalName());
  26.         }
  27. System.out.println();
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment