(Interpreter interp, ST self, Object o, Object property, String propertyName)
| 56 | protected static final Map<Class<?>, Map<String, Member>> membersCache = new HashMap<Class<?>, Map<String, Member>>(); |
| 57 | |
| 58 | @Override |
| 59 | public synchronized Object getProperty(Interpreter interp, ST self, Object o, Object property, String propertyName) throws STNoSuchPropertyException { |
| 60 | if ( o==null ) { |
| 61 | throw new NullPointerException("o"); |
| 62 | } |
| 63 | Class<?> c = o.getClass(); |
| 64 | if ( property==null ) { |
| 65 | return throwNoSuchProperty(c, propertyName, null); |
| 66 | } |
| 67 | Member member = findMember(c, propertyName); |
| 68 | if ( member!=null ) { |
| 69 | try { |
| 70 | if ( member instanceof Method ) { |
| 71 | return ((Method)member).invoke(o); |
| 72 | } |
| 73 | else if ( member instanceof Field ) { |
| 74 | return ((Field)member).get(o); |
| 75 | } |
| 76 | } |
| 77 | catch (Exception e) { |
| 78 | throwNoSuchProperty(c, propertyName, e); |
| 79 | } |
| 80 | } |
| 81 | return throwNoSuchProperty(c, propertyName, null); |
| 82 | } |
| 83 | |
| 84 | protected static Member findMember(Class<?> clazz, String memberName) { |
| 85 | if ( clazz==null ) { |
nothing calls this directly
no test coverage detected