import java.util.*;
import java.lang.*;
import java.lang.reflect.Field;
class WebElement
{
{
this.id = id;
}
{
return this.id;
}
}
class Program
{
public List<WebElement> elem1 = new ArrayList<WebElement>();
public List<WebElement> elem2 = new ArrayList<WebElement>();
public Program()
{
this.elem1.add(new WebElement("id1"));
this.elem2.add(new WebElement("id2"));
}
{
Field field
= this.
getClass().
getField(name
);
List<WebElement> targets = (List<WebElement>)field.get(this);
return targets.get(0);
}
{
Program prog = new Program();
try{
System.
out.
println(prog.
getElement("elem1").
getId()); System.
out.
println(prog.
getElement("elem2").
getId()); }
}
}
CmltcG9ydCBqYXZhLnV0aWwuKjsKaW1wb3J0IGphdmEubGFuZy4qOwppbXBvcnQgamF2YS5sYW5nLnJlZmxlY3QuRmllbGQ7CgpjbGFzcyBXZWJFbGVtZW50CnsKCXB1YmxpYyBXZWJFbGVtZW50KFN0cmluZyBpZCkKCXsKCQl0aGlzLmlkID0gaWQ7Cgl9CgkKCXByaXZhdGUgU3RyaW5nIGlkOwoJCglwdWJsaWMgU3RyaW5nIGdldElkKCkKCXsKCQlyZXR1cm4gdGhpcy5pZDsKCX0KfQoKY2xhc3MgUHJvZ3JhbQp7CglwdWJsaWMgTGlzdDxXZWJFbGVtZW50PiBlbGVtMSA9IG5ldyBBcnJheUxpc3Q8V2ViRWxlbWVudD4oKTsKCXB1YmxpYyBMaXN0PFdlYkVsZW1lbnQ+IGVsZW0yID0gbmV3IEFycmF5TGlzdDxXZWJFbGVtZW50PigpOwoJCglwdWJsaWMgUHJvZ3JhbSgpCgl7CgkJdGhpcy5lbGVtMS5hZGQobmV3IFdlYkVsZW1lbnQoImlkMSIpKTsKCQl0aGlzLmVsZW0yLmFkZChuZXcgV2ViRWxlbWVudCgiaWQyIikpOwoJfQoJCglwdWJsaWMgV2ViRWxlbWVudCBnZXRFbGVtZW50KFN0cmluZyBuYW1lKSB0aHJvd3MgRXhjZXB0aW9uCgl7CgkJRmllbGQgZmllbGQgPSB0aGlzLmdldENsYXNzKCkuZ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