나는이 같은 클래스에서 상수의 목록을 가지고있다구문 분석 문자열 코드
public class MapDialogue{
Constants c1 = new Constants();
public String mappingLabels(String node){
String text = "c1."+node+"_label";
//Is there someway of parsing this text as code
//like in unix shell scripting?
}
}
의 일종을 사용하여 더 나은 것 member/fieldValues.html) -하지만 코드를 재 설계하여 전혀 필요가 없도록 할 수 있습니다. – assylias
[http://stackoverflow.com/questions/935175/convert-string]의 가능한 복제본 -to-code] (http://stackoverflow.com/questions/935175/convert-string-to-code) –
@MartinFahl 그건 전혀 중복되지 않습니다 ... – assylias