}
private <T> T getGroovyProperty(String propName, Class<T> type, boolean onlyStatic) {
Object value = null;
if (GroovyObject.class.isAssignableFrom(getClazz())) {
MetaProperty metaProperty = getMetaClass().getMetaProperty(propName);
if (metaProperty != null) {
int modifiers = metaProperty.getModifiers();
if (Modifier.isStatic(modifiers)) {
value = metaProperty.getProperty(clazz);
}
else if (!onlyStatic) {
value = metaProperty.getProperty(getReferenceInstance());
}
}
}
return returnOnlyIfInstanceOf(value, type);
}