throws BindingException {
Field fld = null;
try {
fld = imported.getField(name);
if (fld == null || !Modifier.isStatic(fld.getModifiers())) {
throw new BindingException("Class "
+ imported.getSimpleName()
+ " does not define field " + name);
} else {
fld.setAccessible(true);
return new StaticFieldReference(fld, context);
}
}
catch (SecurityException e) {
throw new BindingException("Not allowed to access "
+ fld.getName());
}
catch (NoSuchFieldException e) {
throw new BindingException("No attribute called " + name
+ " defined.");
}
}