MCPcopy Index your code
hub / github.com/antlr/codebuff / getProperty

Method getProperty

output/java8/1.4.17/ObjectModelAdaptor.java:58–82  ·  view source on GitHub ↗
(Interpreter interp, ST self, Object o, Object property, String propertyName)

Source from the content-addressed store, hash-verified

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 ) {

Callers

nothing calls this directly

Calls 4

throwNoSuchPropertyMethod · 0.95
findMemberMethod · 0.95
getMethod · 0.65
invokeMethod · 0.45

Tested by

no test coverage detected