Java源码示例:org.eclipse.xtext.service.AbstractElementFinder

示例1
protected StringConcatenationClient parserRuleClasses(final EnumRule it) {
  StringConcatenationClient _client = new StringConcatenationClient() {
    @Override
    protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
      _builder.append("public class ");
      String _gaRuleAccessorClassName = GrammarAccessFragment2.this._grammarAccessExtensions.gaRuleAccessorClassName(it);
      _builder.append(_gaRuleAccessorClassName);
      _builder.append(" extends ");
      _builder.append(AbstractElementFinder.AbstractEnumRuleElementFinder.class);
      _builder.append(" {");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("private final ");
      _builder.append(EnumRule.class, "\t");
      _builder.append(" rule = (");
      _builder.append(EnumRule.class, "\t");
      _builder.append(") ");
      _builder.append(GrammarUtil.class, "\t");
      _builder.append(".findRuleForName(getGrammar(), \"");
      String _qualifiedName = GrammarAccessFragment2.this.getQualifiedName(it);
      _builder.append(_qualifiedName, "\t");
      _builder.append("\");");
      _builder.newLineIfNotEmpty();
      {
        List<AbstractElement> _containedAbstractElements = GrammarUtil.containedAbstractElements(it);
        for(final AbstractElement e : _containedAbstractElements) {
          _builder.append("\t");
          _builder.append("private final ");
          TypeReference _typeRef = TypeReference.typeRef(e.eClass(), GrammarAccessFragment2.this.getLanguage());
          _builder.append(_typeRef, "\t");
          _builder.append(" ");
          String _gaElementAccessorLocalVarName = GrammarAccessFragment2.this.gaElementAccessorLocalVarName(e);
          _builder.append(_gaElementAccessorLocalVarName, "\t");
          _builder.append(" = ");
          StringConcatenationClient _loadElementStatement = GrammarAccessFragment2.this.loadElementStatement(e);
          _builder.append(_loadElementStatement, "\t");
          _builder.append(";");
          _builder.newLineIfNotEmpty();
        }
      }
      _builder.append("\t");
      _builder.newLine();
      _builder.append("\t");
      String _grammarFragmentToString = GrammarAccessFragment2.this._grammarAccessExtensions.grammarFragmentToString(it, "//");
      _builder.append(_grammarFragmentToString, "\t");
      _builder.newLineIfNotEmpty();
      _builder.append("\t");
      _builder.append("public EnumRule getRule() { return rule; }");
      _builder.newLine();
      {
        List<AbstractElement> _containedAbstractElements_1 = GrammarUtil.containedAbstractElements(it);
        for(final AbstractElement e_1 : _containedAbstractElements_1) {
          _builder.append("\t");
          _builder.newLine();
          _builder.append("\t");
          String _grammarFragmentToString_1 = GrammarAccessFragment2.this._grammarAccessExtensions.grammarFragmentToString(e_1, "//");
          _builder.append(_grammarFragmentToString_1, "\t");
          _builder.newLineIfNotEmpty();
          _builder.append("\t");
          _builder.append("public ");
          TypeReference _typeRef_1 = TypeReference.typeRef(e_1.eClass(), GrammarAccessFragment2.this.getLanguage());
          _builder.append(_typeRef_1, "\t");
          _builder.append(" ");
          String _gaElementAccessMethodName = GrammarAccessFragment2.this._grammarAccessExtensions.gaElementAccessMethodName(e_1);
          _builder.append(_gaElementAccessMethodName, "\t");
          _builder.append("() { return ");
          String _gaElementAccessorLocalVarName_1 = GrammarAccessFragment2.this.gaElementAccessorLocalVarName(e_1);
          _builder.append(_gaElementAccessorLocalVarName_1, "\t");
          _builder.append("; }");
          _builder.newLineIfNotEmpty();
        }
      }
      _builder.append("}");
      _builder.newLine();
    }
  };
  return _client;
}