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