1 29 30 package com.caucho.bytecode; 31 32 import java.lang.reflect.Field ; 33 import java.lang.reflect.Modifier ; 34 import java.lang.reflect.ParameterizedType ; 35 import java.lang.reflect.Type ; 36 37 40 public class JFieldWrapper extends JField { 41 private JClassLoader _loader; 42 43 private Field _field; 44 45 public JFieldWrapper(Field field, JClassLoader loader) 46 { 47 _loader = loader; 48 _field = field; 49 } 50 51 54 public String getName() 55 { 56 return _field.getName(); 57 } 58 59 62 public JClass getDeclaringClass() 63 { 64 return _loader.forName(_field.getDeclaringClass().getName()); 65 } 66 67 70 public JClass getType() 71 { 72 return _loader.forName(_field.getType().getName()); 73 } 74 75 78 public JType getGenericType() 79 { 80 try { 81 Type type = _field.getGenericType(); 82 83 if (type instanceof Class ) 84 return getType(); 85 else 86 return new JTypeWrapper(_loader, (ParameterizedType ) type); 87 } catch (NoSuchMethodError e) { 88 return getType(); 89 } 90 } 91 92 95 public boolean isStatic() 96 { 97 return Modifier.isStatic(_field.getModifiers()); 98 } 99 100 103 public boolean isPrivate() 104 { 105 return Modifier.isPrivate(_field.getModifiers()); 106 } 107 108 111 public boolean isTransient() 112 { 113 return Modifier.isTransient(_field.getModifiers()); 114 } 115 } 116 | Popular Tags |