Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- hbase
- management
- Spain
- MySQL
- Software Engineering
- RFID
- QT
- Malaysia
- ubuntu
- Italy
- program
- agile
- France
- Linux
- UK
- erlang
- Book
- Book review
- Programming
- django
- Python
- management and leadership
- hadoop
- Kuala Lumpur
- leadership
- web
- history
- comic agile
- Java
- programming_book
Archives
- Today
- Total
Reflection을 이용해 class variable name 얻기 본문
// http://stackoverflow.com/questions/744226/java-reflection-how-to-get-the-name-of-a-variable import java.lang.reflect.Field; public class TestReflect { public int i = 5; public Integer test = 5; public String omghi = "der"; public static String testStatic = "THIS IS STATIC"; public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException { TestReflect t = new TestReflect(); for(Field f : t.getClass().getFields()) { System.out.println(f.getGenericType() + "\t" + f.getName() + " = " + f.get(t)); } } }
Comments