import org.oorexx.language.enumeration.OORexxAccessModifier;
public class LineToOORexxClass {
public static OORexxClass convert(String line){
OORexxKeywordBean keywordBean = LanguageBeanFactory.getOORexxKeywordBean();
OORexxClass ooRexxClass = new OORexxClass();
String[] words = line.split(" +");
for(int i = 0; i < words.length ; i++){
if(words[i].toLowerCase().equals("::class"))
ooRexxClass.setName(words[i+1].replace("'", "").replace("\"", ""));
if(words[i].toLowerCase().equals("public"))
ooRexxClass.setAccessModifier(OORexxAccessModifier.PUBLIC);
else if(words[i].toLowerCase().equals("private"))
ooRexxClass.setAccessModifier(OORexxAccessModifier.PRIVATE);
if(words[i].toLowerCase().equals("subclass"))
ooRexxClass.setSubClass(new OORexxClass(words[i+1]));
if(words[i].toLowerCase().equals("mixinclass"))
ooRexxClass.setMixinClass(new OORexxClass(words[i+1]));
if(words[i].toLowerCase().equals("inherit")){
for(int k = i + 1; k < words.length ; k++){
if(keywordBean.getClassKeywords().contains(words[k])) break;
ooRexxClass.appendInheritance(new OORexxClass(words[k]));
}
}
if(words[i].toLowerCase().equals("metaclass"))
ooRexxClass.setMetaClass(new OORexxClass(words[i+1]));
}
if(ooRexxClass.getMetaClass() == null)
ooRexxClass.setMetaClass(new OORexxClass("Class"));
return ooRexxClass;
}