소스 검색

add constValue that grabs the value of a field by name

tags/2.0.1
Jonathan Cobb 5 년 전
부모
커밋
006bcd1ff4
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. +12
    -0
      src/main/java/org/cobbzilla/util/reflect/ReflectionUtil.java

+ 12
- 0
src/main/java/org/cobbzilla/util/reflect/ReflectionUtil.java 파일 보기

@@ -1155,4 +1155,16 @@ public class ReflectionUtil {
}
}

public static <T> T constValue(Class type, String fieldName) {
final Field field;
try {
field = type.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e) {
return die("constValue: "+e);
}
return constValue(field);
}

}

불러오는 중...
취소
저장