/**
* @author Mike Brock <cbrock@redhat.com>
*/
public abstract class Refs {
public static VariableReference get(final String name) {
return new VariableReference() {
private MetaClass type;
@Override
public String getName() {
return name;
}
@Override
public Statement getValue() {
return new Statement() {
String generatedCache;
@Override
public String generate(final Context context) {
if (generatedCache != null) return generatedCache;
final VariableReference var = context.getVariable(name);
if (var == null) {
throw new OutOfScopeException("could not access variable: " + name);
}
type = var.getType();
return generatedCache = name;
}
@Override