docs: @SuppressWarnings("checkstyle:all")
  	protected void generateTopElement(TopElementDescription description,
  			boolean forInterface, boolean forAppender) {
  		final AtomicBoolean isExtendKeywordFound = new AtomicBoolean(false);
  		final AtomicBoolean isExtendsKeywordFound = new AtomicBoolean(false);
  		final AtomicBoolean isImplementKeywordFound = new AtomicBoolean(false);
  		final AtomicBoolean isImplementsKeywordFound = new AtomicBoolean(false);
  		final AtomicBoolean isAnnotated = new AtomicBoolean(false);
  		final AtomicBoolean hasModifiers = new AtomicBoolean(false);
  		final AtomicBoolean hasTypeParameters = new AtomicBoolean(false);
  		AbstractRule memberRule = null;
  
  		for (Assignment assignment : GrammarUtil.containedAssignments(description.getElementDescription().getGrammarComponent())) {
  			if (Objects.equals(getCodeBuilderConfig().getModifierListGrammarName(), assignment.getFeature())) {
  				hasModifiers.set(true);
  			} else if (Objects.equals(getCodeBuilderConfig().getTypeParameterListGrammarName(), assignment.getFeature())) {
  					hasTypeParameters.set(true);
  			} else if (Objects.equals(getCodeBuilderConfig().getAnnotationListGrammarName(), assignment.getFeature())) {
  				isAnnotated.set(true);
  			} else if (Objects.equals(getCodeBuilderConfig().getTypeExtensionGrammarName(), assignment.getFeature())) {
  				if (Objects.equals("*", assignment.getCardinality()) //$NON-NLS-1$
  						|| Objects.equals("+=", assignment.getCardinality()) //$NON-NLS-1$
  						|| isExtendKeywordFound.get()) {
  					isExtendsKeywordFound.set(true);
  				}
  				isExtendKeywordFound.set(true);
  			} else if (Objects.equals(getCodeBuilderConfig().getTypeImplementationGrammarName(), assignment.getFeature())) {
  				if (Objects.equals("*", assignment.getCardinality()) //$NON-NLS-1$
  						|| Objects.equals("+=", assignment.getCardinality()) //$NON-NLS-1$
  						|| isImplementKeywordFound.get()) {
  					isImplementsKeywordFound.set(true);
  				}
  				isImplementKeywordFound.set(true);
  			} else if (Objects.equals(getCodeBuilderConfig().getMemberCollectionExtensionGrammarName(), assignment.getFeature())) {
  				if (memberRule == null && assignment.getTerminal() instanceof RuleCall) {
  					memberRule = ((RuleCall) assignment.getTerminal()).getRule();
  				}
  			}
  		}
  
  		if (memberRule != null) {
  			final EClassifier commonSuperClassifier = getCodeElementExtractor().getGeneratedTypeFor(memberRule);
  			getCodeElementExtractor().visitMemberElements(description.getElementDescription(), memberRule,
  					(it, grammarContainer, memberContainer, classifier) -> {
  						description.getConstructors().add(it.newElementDescription(
  								classifier.getName(), memberContainer, classifier, commonSuperClassifier));
  						return null;
  					},
  					(it, grammarContainer, memberContainer, classifier) -> {
  						description.getNamedMembers().add(it.newElementDescription(
  								classifier.getName(), memberContainer, classifier, commonSuperClassifier));
  						return null;
  					},
  					(it, grammarContainer, memberContainer, classifier) -> {
  						description.getUnnamedMembers().add(it.newElementDescription(
  								classifier.getName(), memberContainer, classifier, commonSuperClassifier));
  						return null;
  					});
  		}
  
  		String generatedObjectFieldName = Strings.toFirstLower(description.getElementDescription().getElementType().getSimpleName());
  
  		description.setContent(new StringConcatenationClient() {
  			@Override
  			protected void appendTo(TargetStringConcatenation it) {
  				if (!forInterface && !forAppender) {
  					it.append("\tprivate "); //$NON-NLS-1$
  					it.append(description.getElementDescription().getElementType());
  					it.append(" "); //$NON-NLS-1$
  					it.append(generatedObjectFieldName);
  					it.append(";"); //$NON-NLS-1$
  					it.newLineIfNotEmpty();
  					it.newLine();
  					if (description.isMemberElement()) {
  						it.append("\tprivate "); //$NON-NLS-1$
  						it.append(EObject.class);
  						it.append(" container;"); //$NON-NLS-1$
  						it.newLineIfNotEmpty();
  						it.newLine();
  					}
  				} else {
  					it.append("\t/** Find the reference to the type with the given name."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @param typeName the fully qualified name of the type"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @return the type reference."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t */"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t"); //$NON-NLS-1$
  					if (!forInterface) {
  						it.append("public "); //$NON-NLS-1$
  					}
  					it.append(JvmParameterizedTypeReference.class);
  					it.append(" newTypeRef(String typeName)"); //$NON-NLS-1$
  					if (forInterface) {
  						it.append(";"); //$NON-NLS-1$
  					} else {
  						it.append(" {"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t\treturn this.builder.newTypeRef(typeName);"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t}"); //$NON-NLS-1$
  					}
  					it.newLineIfNotEmpty();
  					it.newLine();
  					it.append("\t/** Find the reference to the type with the given name."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @param context the context for the type reference use"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @param typeName the fully qualified name of the type"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @return the type reference."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t */"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t"); //$NON-NLS-1$
  					if (!forInterface) {
  						it.append("public "); //$NON-NLS-1$
  					}
  					it.append(JvmParameterizedTypeReference.class);
  					it.append(" newTypeRef("); //$NON-NLS-1$
  					it.append(Notifier.class);
  					it.append(" context, String typeName)"); //$NON-NLS-1$
  					if (forInterface) {
  						it.append(";"); //$NON-NLS-1$
  					} else {
  						it.append(" {"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t\treturn this.builder.newTypeRef(context, typeName);"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t}"); //$NON-NLS-1$
  					}
  					it.newLineIfNotEmpty();
  					it.newLine();
  				}
  				if (forInterface) {
  					it.append("\t/** Replies the context for type resolution."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @return the context or <code>null</code> if the Ecore object is the context."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t */"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t"); //$NON-NLS-1$
  					it.append(IJvmTypeProvider.class);
  					it.append(" getTypeResolutionContext();"); //$NON-NLS-1$
  					it.newLineIfNotEmpty();
  					it.newLine();
  				} else if (forAppender) {
  					it.append("\tpublic "); //$NON-NLS-1$
  					it.append(IJvmTypeProvider.class);
  					it.append(" getTypeResolutionContext() {"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t\treturn this.builder.getTypeResolutionContext();"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t}"); //$NON-NLS-1$
  					it.newLineIfNotEmpty();
  					it.newLine();
  				}
  				if (forInterface) {
  					it.append("\t/** Dispose the resource."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t */"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\tvoid dispose();"); //$NON-NLS-1$
  					it.newLineIfNotEmpty();
  					it.newLine();
  				} else if (forAppender) {
  					it.append("\t/** Dispose the resource."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t */"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\tpublic void dispose() {"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t\tthis.builder.dispose();"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t}"); //$NON-NLS-1$
  					it.newLineIfNotEmpty();
  					it.newLine();
  				}
  				if (!forInterface) {
  					it.append("\t@"); //$NON-NLS-1$
  					it.append(Override.class);
  					it.newLine();
  					it.append("\t@"); //$NON-NLS-1$
  					it.append(Pure.class);
  					it.newLine();
  					it.append("\tpublic "); //$NON-NLS-1$
  					it.append(String.class);
  					it.append(" toString() {"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t\treturn "); //$NON-NLS-1$
  					if (forAppender) {
  						it.append("this.builder.toString();"); //$NON-NLS-1$
  					} else {
  						it.append(EmfFormatter.class);
  						it.append(".objToStr("); //$NON-NLS-1$
  						it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
  						it.append(");"); //$NON-NLS-1$
  					}
  					it.newLine();
  					it.append("\t}"); //$NON-NLS-1$
  					it.newLineIfNotEmpty();
  					it.newLine();
  				}
  				it.append("\t/** Initialize the Ecore element when inside a script."); //$NON-NLS-1$
  				it.newLine();
  				it.append("\t */"); //$NON-NLS-1$
  				it.newLine();
  				it.append("\t"); //$NON-NLS-1$
  				if (!forInterface) {
  					it.append("public "); //$NON-NLS-1$
  				}
  				it.append("void eInit("); //$NON-NLS-1$
  				it.append(getCodeElementExtractor().getLanguageScriptInterface());
  				it.append(" script, String name, "); //$NON-NLS-1$
  				it.append(IJvmTypeProvider.class);
  				it.append(" context)"); //$NON-NLS-1$
  				if (forInterface) {
  					it.append(";"); //$NON-NLS-1$
  				} else {
  					it.append(" {"); //$NON-NLS-1$
  					it.newLine();
  					if (forAppender) {
  						it.append("\t\tthis.builder.eInit(script, name, context);"); //$NON-NLS-1$
  					} else {
  						it.append("\t\tsetTypeResolutionContext(context);"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t\tif (this."); //$NON-NLS-1$
  						it.append(generatedObjectFieldName);
  						it.append(" == null) {"); //$NON-NLS-1$
  						it.newLine();
  						if (description.isMemberElement()) {
  							it.append("\t\t\tthis.container = script;"); //$NON-NLS-1$
  							it.newLine();
  						}
  						it.append("\t\t\tthis."); //$NON-NLS-1$
  						it.append(generatedObjectFieldName);
  						it.append(" = "); //$NON-NLS-1$
  						it.append(getXFactoryFor(description.getElementDescription().getElementType()));
  						it.append(".eINSTANCE.create"); //$NON-NLS-1$
  						it.append(Strings.toFirstUpper(description.getElementDescription().getElementType().getSimpleName()));
  						it.append("();"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t\t\tscript."); //$NON-NLS-1$
  						it.append(getLanguageScriptMemberGetter());
  						it.append("().add(this."); //$NON-NLS-1$
  						it.append(generatedObjectFieldName);
  						it.append(");"); //$NON-NLS-1$
  						it.newLine();
  						if (description.isAnnotationInfo()) {
  							final TypeReference commonType = description.getElementDescription().getCommonSuperType();
  							it.append("\t\t\tthis."); //$NON-NLS-1$
  							it.append(generatedObjectFieldName);
  							it.append(".setAnnotationInfo("); //$NON-NLS-1$
  							it.append(getXFactoryFor(commonType));
  							it.append(".eINSTANCE.create"); //$NON-NLS-1$
  							it.append(Strings.toFirstUpper(commonType.getSimpleName()));
  							it.append("());"); //$NON-NLS-1$
  							it.newLine();
  						}
  						it.append("\t\t\tif (!"); //$NON-NLS-1$
  						it.append(Strings.class);
  						it.append(".isEmpty(name)) {"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t\t\t\tthis."); //$NON-NLS-1$
  						it.append(generatedObjectFieldName);
  						it.append(".setName(name);"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t\t\t}"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t\t}"); //$NON-NLS-1$
  					}
  					it.newLine();
  					it.append("\t}"); //$NON-NLS-1$
  				}
  				it.newLineIfNotEmpty();
  				it.newLine();
  				if (description.isMemberElement()) {
  					it.append("\t/** Initialize the Ecore element when inner type declaration."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t */"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t"); //$NON-NLS-1$
  					if (!forInterface) {
  						it.append("public "); //$NON-NLS-1$
  					}
  					it.append("void eInit("); //$NON-NLS-1$
  					it.append(getCodeElementExtractor().getLanguageTopElementType());
  					it.append(" container, String name, "); //$NON-NLS-1$
  					it.append(IJvmTypeProvider.class);
  					it.append(" context)"); //$NON-NLS-1$
  					if (forInterface) {
  						it.append(";"); //$NON-NLS-1$
  					} else {
  						it.append(" {"); //$NON-NLS-1$
  						it.newLine();
  						if (forAppender) {
  							it.append("\t\tthis.builder.eInit(container, name, context);"); //$NON-NLS-1$
  						} else {
  							it.append("\t\tif (this."); //$NON-NLS-1$
  							it.append(generatedObjectFieldName);
  							it.append(" == null) {"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\tthis.container = container;"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\tthis."); //$NON-NLS-1$
  							it.append(generatedObjectFieldName);
  							it.append(" = "); //$NON-NLS-1$
  							it.append(getXFactoryFor(description.getElementDescription().getElementType()));
  							it.append(".eINSTANCE.create"); //$NON-NLS-1$
  							it.append(Strings.toFirstUpper(description.getElementDescription().getElementType().getSimpleName()));
  							it.append("();"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\tcontainer."); //$NON-NLS-1$
  							it.append(getLanguageContainerMemberGetter());
  							it.append("().add(this."); //$NON-NLS-1$
  							it.append(generatedObjectFieldName);
  							it.append(");"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\tif (!"); //$NON-NLS-1$
  							it.append(Strings.class);
  							it.append(".isEmpty(name)) {"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\t\tthis."); //$NON-NLS-1$
  							it.append(generatedObjectFieldName);
  							it.append(".setName(name);"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\t}"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t}"); //$NON-NLS-1$
  						}
  						it.newLine();
  						it.append("\t}"); //$NON-NLS-1$
  					}
  					it.newLineIfNotEmpty();
  					it.newLine();
  				}
  				it.append("\t/** Replies the generated " //$NON-NLS-1$
  						+ description.getElementDescription().getElementType().getSimpleName() + "."); //$NON-NLS-1$
  				it.newLine();
  				it.append("\t */"); //$NON-NLS-1$
  				it.newLine();
  				it.append("\t@"); //$NON-NLS-1$
  				it.append(Pure.class);
  				it.newLine();
  				it.append("\t"); //$NON-NLS-1$
  				if (!forInterface) {
  					it.append("public "); //$NON-NLS-1$
  				}
  				it.append(description.getElementDescription().getElementType());
  				it.append(" "); //$NON-NLS-1$
  				it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
  				if (forInterface) {
  					it.append(";"); //$NON-NLS-1$
  				} else {
  					it.append(" {"); //$NON-NLS-1$
  					it.newLine();
  					if (forAppender) {
  						it.append("\t\treturn this.builder."); //$NON-NLS-1$
  						it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
  						it.append(";"); //$NON-NLS-1$
  					} else {
  						it.append("\t\treturn this."); //$NON-NLS-1$
  						it.append(generatedObjectFieldName);
  						it.append(";"); //$NON-NLS-1$
  					}
  					it.newLine();
  					it.append("\t}"); //$NON-NLS-1$
  				}
  				it.newLineIfNotEmpty();
  				it.newLine();
  				it.append("\t/** Replies the resource to which the " //$NON-NLS-1$
  						+ description.getElementDescription().getElementType().getSimpleName() + " is attached."); //$NON-NLS-1$
  				it.newLine();
  				it.append("\t */"); //$NON-NLS-1$
  				it.newLine();
  				it.append("\t@"); //$NON-NLS-1$
  				it.append(Pure.class);
  				it.newLine();
  				it.append("\t"); //$NON-NLS-1$
  				if (!forInterface) {
  					it.append("public "); //$NON-NLS-1$
  				}
  				it.append(Resource.class);
  				it.append(" eResource()"); //$NON-NLS-1$
  				if (forInterface) {
  					it.append(";"); //$NON-NLS-1$
  				} else {
  					it.append(" {"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t\treturn "); //$NON-NLS-1$
  					it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
  					it.append(".eResource();"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t}"); //$NON-NLS-1$
  				}
  				it.newLineIfNotEmpty();
  				it.newLine();
  				it.append(generateStandardCommentFunctions(forInterface, forAppender,
  						getGeneratedTypeAccessor(description.getElementDescription().getElementType())));
  				if (isExtendKeywordFound.get()) {
  					String defaultType = getCodeBuilderConfig().getDefaultSupers().get(
  							description.getElementDescription().getElementType().getSimpleName());
  					if (isExtendsKeywordFound.get()) {
  						it.append("\t/** Add the super type."); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t * @param superType the qualified name of the super type."); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t */"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t"); //$NON-NLS-1$
  						if (!forInterface) {
  							it.append("public "); //$NON-NLS-1$
  						}
  						it.append("void addExtends(String superType)"); //$NON-NLS-1$
  					} else {
  						it.append("\t/** Change the super type."); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t * @param superType the qualified name of the super type,"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t *     or <code>null</code> if the default type."); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t */"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t"); //$NON-NLS-1$
  						if (!forInterface) {
  							it.append("public "); //$NON-NLS-1$
  						}
  						it.append("void setExtends(String superType)"); //$NON-NLS-1$
  					}
  					if (forInterface) {
  						it.append(";"); //$NON-NLS-1$
  					} else {
  						it.append(" {"); //$NON-NLS-1$
  						it.newLine();
  						if (forAppender) {
  							if (isExtendsKeywordFound.get()) {
  								it.append("\t\tthis.builder.addExtends(superType);"); //$NON-NLS-1$
  							} else {
  								it.append("\t\tthis.builder.setExtends(superType);"); //$NON-NLS-1$
  							}
  						} else {
  							it.append("\t\tif (!"); //$NON-NLS-1$
  							it.append(Strings.class);
  							it.append(".isEmpty(superType)"); //$NON-NLS-1$
  							if (!Strings.isEmpty(defaultType)) {
  								it.newLine();
  								it.append("\t\t\t\t&& !"); //$NON-NLS-1$
  								it.append(new TypeReference(defaultType));
  								it.append(".class.getName().equals(superType)"); //$NON-NLS-1$
  							}
  							it.append(") {"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\t"); //$NON-NLS-1$
  							it.append(JvmParameterizedTypeReference.class);
  							it.append(" superTypeRef = newTypeRef(this."); //$NON-NLS-1$
  							if (description.isMemberElement()) {
  								it.append("container"); //$NON-NLS-1$
  							} else {
  								it.append(generatedObjectFieldName);
  							}
  							it.append(", superType);"); //$NON-NLS-1$
  							it.newLine();
  							if (!Strings.isEmpty(defaultType)) {
  								it.append("\t\t\t"); //$NON-NLS-1$
  								it.append(JvmTypeReference.class);
  								it.append(" baseTypeRef = findType(this."); //$NON-NLS-1$
  								if (description.isMemberElement()) {
  									it.append("container"); //$NON-NLS-1$
  								} else {
  									it.append(generatedObjectFieldName);
  								}
  								it.append(", "); //$NON-NLS-1$
  								it.append(new TypeReference(defaultType));
  								it.append(".class.getCanonicalName());"); //$NON-NLS-1$
  								it.newLine();
  								it.append("\t\t\tif (isSubTypeOf(this."); //$NON-NLS-1$
  								if (description.isMemberElement()) {
  									it.append("container"); //$NON-NLS-1$
  								} else {
  									it.append(generatedObjectFieldName);
  								}
  								it.append(", superTypeRef, baseTypeRef)) {"); //$NON-NLS-1$
  								it.newLine();
  								it.append("\t\t\t\t"); //$NON-NLS-1$
  							} else {
  								it.append("\t\t\t"); //$NON-NLS-1$
  							}
  							it.append("this."); //$NON-NLS-1$
  							it.append(generatedObjectFieldName);
  							if (isExtendsKeywordFound.get()) {
  								it.append(".getExtends().add(superTypeRef);"); //$NON-NLS-1$
  							} else {
  								it.append(".setExtends(superTypeRef);"); //$NON-NLS-1$
  							}
  							it.newLine();
  							if (!Strings.isEmpty(defaultType)) {
  								it.append("\t\t\t\treturn;"); //$NON-NLS-1$
  							} else {
  								it.append("\t\t\treturn;"); //$NON-NLS-1$
  							}
  							it.newLine();
  							if (!Strings.isEmpty(defaultType)) {
  								it.append("\t\t\t}"); //$NON-NLS-1$
  								it.newLine();
  							}
  							it.append("\t\t}"); //$NON-NLS-1$
  							it.newLine();
  							if (!isExtendsKeywordFound.get()) {
  								it.append("\t\tthis."); //$NON-NLS-1$
  								it.append(generatedObjectFieldName);
  								it.append(".setExtends(null);"); //$NON-NLS-1$
  								it.newLine();
  							}
  						}
  						it.append("\t}"); //$NON-NLS-1$
  					}
  					it.newLineIfNotEmpty();
  					it.newLine();
  				}
  				if (isImplementKeywordFound.get()) {
  					if (isImplementsKeywordFound.get()) {
  						it.append("\t/** Add an implemented type."); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t * @param type the qualified name of the implemented type."); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t */"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t"); //$NON-NLS-1$
  						if (!forInterface) {
  							it.append("public "); //$NON-NLS-1$
  						}
  						it.append("void addImplements(String type)"); //$NON-NLS-1$
  						if (forInterface) {
  							it.append(";"); //$NON-NLS-1$
  						} else {
  							it.append(" {"); //$NON-NLS-1$
  							it.newLine();
  							if (forAppender) {
  								it.append("\t\tthis.builder.addImplements(type);"); //$NON-NLS-1$
  							} else {
  								it.append("\t\tif (!"); //$NON-NLS-1$
  								it.append(Strings.class);
  								it.append(".isEmpty(type)) {"); //$NON-NLS-1$
  								it.newLine();
  								it.append("\t\t\tthis."); //$NON-NLS-1$
  								it.append(generatedObjectFieldName);
  								it.append(".getImplements().add(newTypeRef(this."); //$NON-NLS-1$
  								if (description.isMemberElement()) {
  									it.append("container"); //$NON-NLS-1$
  								} else {
  									it.append(generatedObjectFieldName);
  								}
  								it.append(", type));"); //$NON-NLS-1$
  								it.newLine();
  								it.append("\t\t}"); //$NON-NLS-1$
  							}
  							it.newLine();
  							it.append("\t}"); //$NON-NLS-1$
  						}
  						it.newLineIfNotEmpty();
  						it.newLine();
  					} else {
  						it.append("\t/** Change the implemented type."); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t * @param type the qualified name of the implemented type,"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t *     or <code>null</code> for nothing."); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t */"); //$NON-NLS-1$
  						it.newLine();
  						it.append("\t"); //$NON-NLS-1$
  						if (!forInterface) {
  							it.append("public "); //$NON-NLS-1$
  						}
  						it.append("void setImplements(String type)"); //$NON-NLS-1$
  						if (forInterface) {
  							it.append(";"); //$NON-NLS-1$
  						} else {
  							it.append(" {"); //$NON-NLS-1$
  							it.newLine();
  							if (forAppender) {
  								it.append("\t\tthis.builder.setImplements(type);"); //$NON-NLS-1$
  							} else {
  								it.append("\t\tthis."); //$NON-NLS-1$
  								it.append(generatedObjectFieldName);
  								it.append(".setImplements("); //$NON-NLS-1$
  								it.newLine();
  								it.append("\t\t\t("); //$NON-NLS-1$
  								it.append(Strings.class);
  								it.append(".isEmpty(type)) ? null : newTypeRef(this."); //$NON-NLS-1$
  								if (description.isMemberElement()) {
  									it.append("container"); //$NON-NLS-1$
  								} else {
  									it.append(generatedObjectFieldName);
  								}
  								it.append(", type));"); //$NON-NLS-1$
  							}
  							it.newLine();
  							it.append("\t}"); //$NON-NLS-1$
  						}
  						it.newLineIfNotEmpty();
  						it.newLine();
  					}
  				}
  				if (isAnnotated.get()) {
  					it.append("\t/** Add an annotation."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @param type the qualified name of the annotation."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t */"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t"); //$NON-NLS-1$
  					if (!forInterface) {
  						it.append("public "); //$NON-NLS-1$
  					}
  					it.append("void addAnnotation(String type)"); //$NON-NLS-1$
  					if (forInterface) {
  						it.append(";"); //$NON-NLS-1$
  					} else {
  						it.append(" {"); //$NON-NLS-1$
  						it.newLine();
  						if (forAppender) {
  							it.append("\t\tthis.builder.addAnnotation(type);"); //$NON-NLS-1$
  						} else {
  							it.append("\t\tif (!"); //$NON-NLS-1$
  							it.append(Strings.class);
  							it.append(".isEmpty(type)) {"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\t"); //$NON-NLS-1$
  							it.append(XAnnotation.class);
  							it.append(" annotation = "); //$NON-NLS-1$
  							it.append(XAnnotationsFactory.class);
  							it.append(".eINSTANCE.createXAnnotation();"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\tannotation.setAnnotationType(newTypeRef(this."); //$NON-NLS-1$
  							if (description.isMemberElement()) {
  								it.append("container"); //$NON-NLS-1$
  							} else {
  								it.append(generatedObjectFieldName);
  							}
  							it.append(", type).getType());"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\tthis."); //$NON-NLS-1$
  							it.append(generatedObjectFieldName);
  							it.append(".getAnnotations().add(annotation);"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t}"); //$NON-NLS-1$
  						}
  						it.newLine();
  						it.append("\t}"); //$NON-NLS-1$
  					}
  					it.newLineIfNotEmpty();
  					it.newLine();
  				}
  				if (hasModifiers.get()) {
  					it.append("\t/** Add a modifier."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @param modifier the modifier to add."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t */"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t"); //$NON-NLS-1$
  					if (!forInterface) {
  						it.append("public "); //$NON-NLS-1$
  					}
  					it.append("void addModifier(String modifier)"); //$NON-NLS-1$
  					if (forInterface) {
  						it.append(";"); //$NON-NLS-1$
  					} else {
  						it.append(" {"); //$NON-NLS-1$
  						it.newLine();
  						if (forAppender) {
  							it.append("\t\tthis.builder.addModifier(modifier);"); //$NON-NLS-1$
  						} else {
  							it.append("\t\tif (!"); //$NON-NLS-1$
  							it.append(Strings.class);
  							it.append(".isEmpty(modifier)) {"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t\tthis."); //$NON-NLS-1$
  							it.append(generatedObjectFieldName);
  							it.append(".getModifiers().add(modifier);"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\t}"); //$NON-NLS-1$
  						}
  						it.newLine();
  						it.append("\t}"); //$NON-NLS-1$
  					}
  					it.newLineIfNotEmpty();
  					it.newLine();
  				}
  				if (hasTypeParameters.get()) {
  					if (!forInterface && !forAppender) {
  						it.append("\t@"); //$NON-NLS-1$
  						it.append(Inject.class);
  						it.newLine();
  						it.append("\tprivate "); //$NON-NLS-1$
  						it.append(Provider.class);
  						it.append("<"); //$NON-NLS-1$
  						it.append(getTypeParameterBuilderInterface());
  						it.append("> iTypeParameterBuilderProvider;"); //$NON-NLS-1$
  						it.newLineIfNotEmpty();
  						it.newLine();
  					}
  					it.append("\t/** Add a type parameter."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @param name the simple name of the type parameter."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t * @return the builder of type parameter."); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t */"); //$NON-NLS-1$
  					it.newLine();
  					it.append("\t"); //$NON-NLS-1$
  					if (!forInterface) {
  						it.append("public "); //$NON-NLS-1$
  					}
  					it.append(getTypeParameterBuilderInterface());
  					it.append(" addTypeParameter(String name)"); //$NON-NLS-1$
  					if (forInterface) {
  						it.append(";"); //$NON-NLS-1$
  					} else {
  						it.append(" {"); //$NON-NLS-1$
  						it.newLine();
  						if (forAppender) {
  							it.append("\t\treturn this.builder.addTypeParameter(name);"); //$NON-NLS-1$
  						} else {
  							it.append("\t\t"); //$NON-NLS-1$
  							it.append(getTypeParameterBuilderInterface());
  							it.append(" builder = this.iTypeParameterBuilderProvider.get();"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\tfinal "); //$NON-NLS-1$
  							it.append(description.getElementDescription().getElementType());
  							it.append(" object = "); //$NON-NLS-1$
  							it.append(getGeneratedTypeAccessor(description.getElementDescription().getElementType()));
  							it.append(";"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\tbuilder.eInit(object, name, getTypeResolutionContext());"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\tobject.getTypeParameters().add(builder.getJvmTypeParameter());"); //$NON-NLS-1$
  							it.newLine();
  							it.append("\t\treturn builder;"); //$NON-NLS-1$
  						}
  						it.newLine();
  						it.append("\t}"); //$NON-NLS-1$
  					}
  					it.newLineIfNotEmpty();
  					it.newLine();
  				}
  			}
  		});
  	}