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 |
Tags
- programming_book
- history
- management
- Book review
- Italy
- web
- Programming
- Spain
- agile
- program
- Software Engineering
- RFID
- Python
- hbase
- psychology
- django
- MySQL
- Linux
- QT
- France
- Malaysia
- leadership
- ubuntu
- erlang
- Java
- Kuala Lumpur
- comic agile
- Book
- hadoop
- essay
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