コード例 #1
0
 public void generate(JNIField field) {
   String name = field.getName();
   Enumeration keys = files.keys();
   while (keys.hasMoreElements()) {
     Object key = keys.nextElement();
     String str = (String) files.get(key);
     if (str.indexOf(name) != -1) {
       int modifiers = field.getModifiers();
       String modifiersStr = Modifier.toString(modifiers);
       output("\t");
       output(modifiersStr);
       if (modifiersStr.length() > 0) output(" ");
       output(field.getType().getTypeSignature3(false));
       output(" ");
       output(field.getName());
       output(" = ");
       output(getFieldValue(field));
       outputln(";");
       usedCount++;
       return;
     }
   }
   unusedCount++;
   // output("NOT USED=" + field.toString() + " \n");
 }
コード例 #2
0
 public void generate(JNIField field) {
   String name = field.getName();
   Iterator<File> keys = files.keySet().iterator();
   while (keys.hasNext()) {
     File key = keys.next();
     String str = files.get(key);
     if (str.indexOf(name) != -1) {
       int modifiers = field.getModifiers();
       String modifiersStr = Modifier.toString(modifiers);
       output("\t");
       output(modifiersStr);
       if (modifiersStr.length() > 0) output(" ");
       output(field.getType().getTypeSignature3(false));
       output(" ");
       output(field.getName());
       output(" = ");
       output(getFieldValue(field));
       outputln(";");
       usedCount++;
       return;
     }
   }
   unusedCount++;
   // output("NOT USED=" + field.toString() + " \n");
 }
コード例 #3
0
 public void generate(JNIField[] fields) {
   sort(fields);
   for (int i = 0; i < fields.length; i++) {
     JNIField field = fields[i];
     if ((field.getModifiers() & Modifier.FINAL) == 0) continue;
     generate(field);
   }
 }
コード例 #4
0
 String getFieldValue(JNIField field) {
   String name = field.getName();
   int index = 0;
   while (true) {
     index = classSource.indexOf(name, index + 1);
     if (index == -1) return null;
     int equalsIndex = classSource.indexOf("=", index);
     if (classSource.substring(index + name.length(), equalsIndex).trim().length() == 0) {
       int semiIndex = classSource.indexOf(";", equalsIndex);
       return classSource.substring(equalsIndex + 1, semiIndex).trim();
     }
   }
 }