You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2015/11/30 06:01:26 UTC

svn commit: r1717172 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java

Author: schor
Date: Mon Nov 30 05:01:26 2015
New Revision: 1717172

URL: http://svn.apache.org/viewvc?rev=1717172&view=rev
Log:
[UIMA-4679] add method to get static field without inheritance, needed by FSClassRegistry

Modified:
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java?rev=1717172&r1=1717171&r2=1717172&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/util/Misc.java Mon Nov 30 05:01:26 2015
@@ -192,6 +192,17 @@ public class Misc {
     } 
   }
   
+  static public int getStaticIntFieldNoInherit(Class<?> clazz, String fieldName) {
+    try {
+      Field f = clazz.getDeclaredField(fieldName);
+      return f.getInt(null);
+    } catch (NoSuchFieldException e) {
+      return Integer.MIN_VALUE;
+    } catch (SecurityException | IllegalArgumentException | IllegalAccessException e) {
+        throw new RuntimeException(e);
+    } 
+  }
+  
   static public void addAll(Collection<String> c, String ... v) {
     for (String s : v) {
       c.add(s);