@SuppressWarnings("checkstyle:all")
	protected StringConcatenationClient generateMembers(boolean forInterface, boolean forAppender) {
		final ExpressionContextDescription expressionContext = getExpressionContextDescription();
		return new StringConcatenationClient() {
			@Override
			protected void appendTo(TargetStringConcatenation it) {
				if (!forInterface && !forAppender) {
					it.append("\tprivate "); //$NON-NLS-1$
					it.append(EObject.class);
					it.append(" context;"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
					it.append("\tprivate "); //$NON-NLS-1$
					it.append(Procedures.Procedure1.class);
					it.append("<? super "); //$NON-NLS-1$
					it.append(XExpression.class);
					it.append("> setter;"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
					it.append("\tprivate "); //$NON-NLS-1$
					it.append(XExpression.class);
					it.append(" expr;"); //$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();
				}
				it.append("\t/** Initialize the expression."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param context the context of the expressions."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param setter the object that permits to assign the expression to the context."); //$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(EObject.class);
				it.append(" context, "); //$NON-NLS-1$
				it.append(Procedures.Procedure1.class);
				it.append("<? super "); //$NON-NLS-1$
				it.append(XExpression.class);
				it.append("> setter, "); //$NON-NLS-1$
				it.append(IJvmTypeProvider.class);
				it.append(" typeContext)"); //$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(context, setter, typeContext);"); //$NON-NLS-1$
					} else {
						it.append("\t\tsetTypeResolutionContext(typeContext);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tthis.context = context;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tthis.setter = setter;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tthis.expr = null;"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the last created expression."); //$NON-NLS-1$
				it.newLine();
				it.append("\t *"); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the last created expression."); //$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(XExpression.class);
				it.append(" getXExpression()"); //$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.getXExpression();"); //$NON-NLS-1$
					} else {
						it.append("\t\treturn this.expr;"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the resource to which the XExpression 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 getXExpression().eResource();"); //$NON-NLS-1$
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Change the expression in the container."); //$NON-NLS-1$
				it.newLine();
				it.append("\t *"); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param expression the textual representation of the expression."); //$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 setExpression(String expression)"); //$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.setExpression(expression);"); //$NON-NLS-1$
					} else {
						it.append("\t\tthis.expr = fromString(expression);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tthis.setter.apply(this.expr);"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Change the expression in the container."); //$NON-NLS-1$
				it.newLine();
				it.append("\t *"); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param expression the expression."); //$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 setXExpression("); //$NON-NLS-1$
				it.append(XExpression.class);
				it.append(" expression)"); //$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.setXExpression(expression);"); //$NON-NLS-1$
					} else {
						it.append("\t\tthis.expr = expression;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tthis.setter.apply(this.expr);"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				if (!forInterface && !forAppender) {
					it.append("\t/** Generate a piece of "); //$NON-NLS-1$
					it.append(getLanguageName());
					it.append(" code that permits to compile an XExpression."); //$NON-NLS-1$
					it.newLine();
					it.append("\t *"); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @param expression the expression to compile."); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @return the "); //$NON-NLS-1$
					it.append(getLanguageName());
					it.append(" code."); //$NON-NLS-1$
					it.newLine();
					it.append("\t */"); //$NON-NLS-1$
					it.newLine();
					it.append("\tstatic String generateExpressionCode(String expression) {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\treturn \""); //$NON-NLS-1$
					it.append(expressionContext.getContainerKeyword());
					it.append(" ____synthesis { "); //$NON-NLS-1$
					it.append(expressionContext.getFieldDeclarationKeyword());
					it.append(" ____fakefield = \" + expression + \" }\";"); //$NON-NLS-1$
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
					it.append("\tstatic String generateTypenameCode(String typeName) {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\treturn \""); //$NON-NLS-1$
					it.append(expressionContext.getContainerKeyword());
					it.append(" ____synthesis { "); //$NON-NLS-1$
					it.append(expressionContext.getFieldDeclarationKeyword());
					it.append(" ____fakefield : \" + typeName + \" }\";"); //$NON-NLS-1$
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
					it.append("\tstatic "); //$NON-NLS-1$
					it.append(JvmParameterizedTypeReference.class);
					it.append(" parseType("); //$NON-NLS-1$
					it.append(Notifier.class);
					it.append(" context, String typeName, "); //$NON-NLS-1$
					it.append(getAbstractBuilderImpl());
					it.append(" caller) {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t"); //$NON-NLS-1$
					it.append(ResourceSet.class);
					it.append(" resourceSet = toResource(context).getResourceSet();"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t"); //$NON-NLS-1$
					it.append(URI.class);
					it.append(" uri = caller.computeUnusedUri(resourceSet);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t"); //$NON-NLS-1$
					it.append(Resource.class);
					it.append(" resource = caller.getResourceFactory().createResource(uri);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\tresourceSet.getResources().add(resource);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\ttry ("); //$NON-NLS-1$
					it.append(StringInputStream.class);
					it.append(" is = new "); //$NON-NLS-1$
					it.append(StringInputStream.class);
					it.append("(generateTypenameCode(typeName))) {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\tresource.load(is, null);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t"); //$NON-NLS-1$
					it.append(getCodeElementExtractor().getLanguageScriptInterface());
					it.append(" script = resource.getContents().isEmpty() ? null : ("); //$NON-NLS-1$
					it.append(getCodeElementExtractor().getLanguageScriptInterface());
					it.append(") resource.getContents().get(0);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t"); //$NON-NLS-1$
					it.append(expressionContext.getContainerDescription().getElementType());
					it.append(" topElement = ("); //$NON-NLS-1$
					it.append(expressionContext.getContainerDescription().getElementType());
					it.append(") script."); //$NON-NLS-1$
					it.append(getLanguageScriptMemberGetter());
					it.append("().get(0);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t"); //$NON-NLS-1$
					it.append(expressionContext.getMemberDescription().getElementType());
					it.append(" member = ("); //$NON-NLS-1$
					it.append(expressionContext.getMemberDescription().getElementType());
					it.append(") topElement.get"); //$NON-NLS-1$
					it.append(Strings.toFirstUpper(getCodeBuilderConfig().getMemberCollectionExtensionGrammarName()));
					it.append("().get(0);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t"); //$NON-NLS-1$
					it.append(JvmTypeReference.class);
					it.append(" reference = member.getType();"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\tif (reference instanceof "); //$NON-NLS-1$
					it.append(JvmParameterizedTypeReference.class);
					it.append(") {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\tfinal "); //$NON-NLS-1$
					it.append(JvmParameterizedTypeReference.class);
					it.append(" pref = ("); //$NON-NLS-1$
					it.append(JvmParameterizedTypeReference.class);
					it.append(") reference;"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\tif (!pref.getArguments().isEmpty()) {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\t\t"); //$NON-NLS-1$
					it.append(EcoreUtil2.class);
					it.append(".resolveAll(resource);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\t\treturn pref;"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\t}"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t}"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t} catch ("); //$NON-NLS-1$
					it.append(Exception.class);
					it.append(" exception) {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\tthrow new "); //$NON-NLS-1$
					it.append(TypeNotPresentException.class);
					it.append("(typeName, exception);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t} finally {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\tresourceSet.getResources().remove(resource);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t}"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\tthrow new "); //$NON-NLS-1$
					it.append(TypeNotPresentException.class);
					it.append("(typeName, null);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();					
					it.append("\t/** Create an expression but does not change the container."); //$NON-NLS-1$
					it.newLine();
					it.append("\t *"); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @param expression the textual representation of the expression."); //$NON-NLS-1$
					it.newLine();
					it.append("\t * @return the expression."); //$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("\tprotected "); //$NON-NLS-1$
					it.append(XExpression.class);
					it.append(" fromString(String expression)"); //$NON-NLS-1$
					it.append(" {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\tif (!"); //$NON-NLS-1$
					it.append(Strings.class);
					it.append(".isEmpty(expression)) {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t"); //$NON-NLS-1$
					it.append(ResourceSet.class);
					it.append(" resourceSet = this.context.eResource().getResourceSet();"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t"); //$NON-NLS-1$
					it.append(URI.class);
					it.append(" uri = computeUnusedUri(resourceSet);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t"); //$NON-NLS-1$
					it.append(Resource.class);
					it.append(" resource = getResourceFactory().createResource(uri);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\tresourceSet.getResources().add(resource);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\ttry ("); //$NON-NLS-1$
					it.append(StringInputStream.class);
					it.append(" is = new "); //$NON-NLS-1$
					it.append(StringInputStream.class);
					it.append("(generateExpressionCode(expression))) {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\tresource.load(is, null);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\t"); //$NON-NLS-1$
					it.append(getCodeElementExtractor().getLanguageScriptInterface());
					it.append(" script = resource.getContents().isEmpty() ? null : ("); //$NON-NLS-1$
					it.append(getCodeElementExtractor().getLanguageScriptInterface());
					it.append(") resource.getContents().get(0);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\t"); //$NON-NLS-1$
					it.append(expressionContext.getContainerDescription().getElementType());
					it.append(" topElement = ("); //$NON-NLS-1$
					it.append(expressionContext.getContainerDescription().getElementType());
					it.append(") script."); //$NON-NLS-1$
					it.append(getLanguageScriptMemberGetter());
					it.append("().get(0);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\t"); //$NON-NLS-1$
					it.append(expressionContext.getMemberDescription().getElementType());
					it.append(" member = ("); //$NON-NLS-1$
					it.append(expressionContext.getMemberDescription().getElementType());
					it.append(") topElement.get"); //$NON-NLS-1$
					it.append(Strings.toFirstUpper(getCodeBuilderConfig().getMemberCollectionExtensionGrammarName()));
					it.append("().get(0);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\treturn member.get"); //$NON-NLS-1$
					it.append(Strings.toFirstUpper(expressionContext.getExpressionAssignment().getFeature()));
					it.append("();"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t} catch (Throwable exception) {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\tthrow new RuntimeException(exception);"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t} finally {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t\t\tresourceSet.getResources().remove(resource);"); //$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\tthrow new IllegalArgumentException(\"not a valid expression\");"); //$NON-NLS-1$
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the XExpression for the default value associated to the given type."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param type the type for which the default value should be determined."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the default value."); //$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(XExpression.class);
				it.append(" getDefaultXExpressionForType(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\treturn this.builder.getDefaultXExpressionForType(type);"); //$NON-NLS-1$
					} else {
						it.append("\t\t//TODO: Check if a similar function exists in the Xbase library."); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t"); //$NON-NLS-1$
						it.append(XExpression.class);
						it.append(" expr = null;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tif (type != null && !\"void\".equals(type) && !Void.class.getName().equals(type)) {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tswitch (type) {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"boolean\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.Boolean\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\t"); //$NON-NLS-1$
						it.append(XBooleanLiteral.class);
						it.append(" booleanLiteral = "); //$NON-NLS-1$
						it.append(XbaseFactory.class);
						it.append(".eINSTANCE.createXBooleanLiteral();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbooleanLiteral.setIsTrue(false);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\texpr = booleanLiteral;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"float\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.Float\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\t"); //$NON-NLS-1$
						it.append(XNumberLiteral.class);
						it.append(" numberLiteral = "); //$NON-NLS-1$
						it.append(XbaseFactory.class);
						it.append(".eINSTANCE.createXNumberLiteral();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tnumberLiteral.setValue(\"0.0f\");"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\texpr = numberLiteral;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"double\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.Double\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.BigDecimal\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tnumberLiteral = "); //$NON-NLS-1$
						it.append(XbaseFactory.class);
						it.append(".eINSTANCE.createXNumberLiteral();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tnumberLiteral.setValue(\"0.0\");"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\texpr = numberLiteral;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"int\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"long\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.Integer\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.Long\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.BigInteger\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tnumberLiteral = "); //$NON-NLS-1$
						it.append(XbaseFactory.class);
						it.append(".eINSTANCE.createXNumberLiteral();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tnumberLiteral.setValue(\"0\");"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\texpr = numberLiteral;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"byte\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"short\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"char\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.Byte\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.Short\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"java.lang.Character\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tnumberLiteral = "); //$NON-NLS-1$
						it.append(XbaseFactory.class);
						it.append(".eINSTANCE.createXNumberLiteral();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tnumberLiteral.setValue(\"0\");"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\t"); //$NON-NLS-1$
						it.append(XCastedExpression.class);
						it.append(" castExpression = "); //$NON-NLS-1$
						it.append(XbaseFactory.class);
						it.append(".eINSTANCE.createXCastedExpression();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tcastExpression.setTarget(numberLiteral);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tcastExpression.setType(newTypeRef(this.context, type));"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\texpr = numberLiteral;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tdefault:"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\texpr = "); //$NON-NLS-1$
						it.append(XbaseFactory.class);
						it.append(".eINSTANCE.createXNullLiteral();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$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\treturn expr;"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t/** Replies the default value for the given type."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @param type the type for which the default value should be determined."); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the default value."); //$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("String getDefaultValueForType(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\treturn this.builder.getDefaultValueForType(type);"); //$NON-NLS-1$
					} else {
						it.append("\t\t//TODO: Check if a similar function exists in the Xbase library."); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tString defaultValue = \"\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tif (!"); //$NON-NLS-1$
						it.append(Strings.class);
						it.append(".isEmpty(type) && !\"void\".equals(type)) {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tswitch (type) {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"boolean\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tdefaultValue = \"true\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"double\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tdefaultValue = \"0.0\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"float\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tdefaultValue = \"0.0f\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"int\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tdefaultValue = \"0\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"long\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tdefaultValue = \"0\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"byte\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tdefaultValue = \"(0 as byte)\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"short\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tdefaultValue = \"(0 as short)\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tcase \"char\":"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tdefaultValue = \"(0 as char)\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tdefault:"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tdefaultValue = \"null\";"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tbreak;"); //$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\treturn defaultValue;"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();
				it.append(generateStandardCommentFunctions(forInterface, forAppender, "getXExpression()")); //$NON-NLS-1$
				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(getXExpression());"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
					it.newLineIfNotEmpty();
					it.newLine();
				}
				it.append("\t/** Create a reference to \"this\" object or to the current type."); //$NON-NLS-1$
				it.newLine();
				it.append("\t *"); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the 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(XFeatureCall.class);
				it.append(" createReferenceToThis()"); //$NON-NLS-1$
				if (forInterface) {
					it.append(";"); //$NON-NLS-1$
				} else {
					it.append(" {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t"); //$NON-NLS-1$
					if (forAppender) {
						it.append("return this.builder.createReferenceToThis();"); //$NON-NLS-1$
					} else {
						it.append("final "); //$NON-NLS-1$
						it.append(XExpression.class);
						it.append(" expr = getXExpression();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t"); //$NON-NLS-1$
						it.append(XtendTypeDeclaration.class);
						it.append(" type = "); //$NON-NLS-1$
						it.append(EcoreUtil2.class);
						it.append(".getContainerOfType(expr, "); //$NON-NLS-1$
						it.append(XtendTypeDeclaration.class);
						it.append(".class);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t"); //$NON-NLS-1$
						it.append(JvmType.class);
						it.append(" jvmObject = getAssociatedElement("); //$NON-NLS-1$
						it.append(JvmType.class);
						it.append(".class, type, expr.eResource());"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tfinal "); //$NON-NLS-1$
						it.append(XFeatureCall.class);
						it.append(" thisFeature = "); //$NON-NLS-1$
						it.append(XbaseFactory.class);
						it.append(".eINSTANCE.createXFeatureCall();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tthisFeature.setFeature(jvmObject);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\treturn thisFeature;"); //$NON-NLS-1$
					}
					it.newLine();
					it.append("\t}"); //$NON-NLS-1$
				}
				it.newLineIfNotEmpty();
				it.newLine();

				it.append("\t/** Create a reference to \"super\" object or to the super type."); //$NON-NLS-1$
				it.newLine();
				it.append("\t *"); //$NON-NLS-1$
				it.newLine();
				it.append("\t * @return the 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(XFeatureCall.class);
				it.append(" createReferenceToSuper()"); //$NON-NLS-1$
				if (forInterface) {
					it.append(";"); //$NON-NLS-1$
				} else {
					it.append(" {"); //$NON-NLS-1$
					it.newLine();
					it.append("\t\t"); //$NON-NLS-1$
					if (forAppender) {
						it.append("return this.builder.createReferenceToSuper();"); //$NON-NLS-1$
					} else {
						it.append("final "); //$NON-NLS-1$
						it.append(XExpression.class);
						it.append(" expr = getXExpression();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t"); //$NON-NLS-1$
						it.append(XtendTypeDeclaration.class);
						it.append(" type = "); //$NON-NLS-1$
						it.append(EcoreUtil2.class);
						it.append(".getContainerOfType(expr, "); //$NON-NLS-1$
						it.append(XtendTypeDeclaration.class);
						it.append(".class);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t"); //$NON-NLS-1$
						it.append(JvmType.class);
						it.append(" jvmObject = getAssociatedElement("); //$NON-NLS-1$
						it.append(JvmType.class);
						it.append(".class, type, expr.eResource());"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tfinal "); //$NON-NLS-1$
						it.append(XFeatureCall.class);
						it.append(" superFeature = "); //$NON-NLS-1$
						it.append(XbaseFactory.class);
						it.append(".eINSTANCE.createXFeatureCall();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t"); //$NON-NLS-1$
						it.append(JvmIdentifiableElement.class);
						it.append(" feature;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tif (jvmObject instanceof "); //$NON-NLS-1$
						it.append(JvmDeclaredType.class);
						it.append(") {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tfeature = (("); //$NON-NLS-1$
						it.append(JvmDeclaredType.class);
						it.append(") jvmObject).getExtendedClass().getType();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t} else {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tfeature = findType(expr, getQualifiedName(type)).getType();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\tif (feature instanceof "); //$NON-NLS-1$
						it.append(JvmDeclaredType.class);
						it.append(") {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tfeature = (("); //$NON-NLS-1$
						it.append(JvmDeclaredType.class);
						it.append(") feature).getExtendedClass().getType();"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t} else {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\t\tfeature = null;"); //$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\tif (feature == null) {"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t\treturn null;"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\t}"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\tsuperFeature.setFeature(feature);"); //$NON-NLS-1$
						it.newLine();
						it.append("\t\treturn superFeature;"); //$NON-NLS-1$
					}
					it.newLine();
					it.newLineIfNotEmpty();
					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();
				}
			}
		};
	}
@ SuppressWarnings ( "checkstyle:all" ) protected StringConcatenationClient generateMembers ( boolean forInterface , boolean forAppender ) { final ExpressionContextDescription expressionContext = getExpressionContextDescription ( ) ; return new StringConcatenationClient ( ) { @ Override protected void appendTo ( TargetStringConcatenation it ) { if ( ! forInterface && ! forAppender ) { it . append ( "\tprivate " ) ; it . append ( EObject . class ) ; it . append ( " context;" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\tprivate " ) ; it . append ( Procedures . Procedure1 . class ) ; it . append ( "<? super " ) ; it . append ( XExpression . class ) ; it . append ( "> setter;" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\tprivate " ) ; it . append ( XExpression . class ) ; it . append ( " expr;" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; } else { it . append ( "\t/** Find the reference to the type with the given name." ) ; it . newLine ( ) ; it . append ( "\t * @param typeName the fully qualified name of the type" ) ; it . newLine ( ) ; it . append ( "\t * @return the type reference." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( JvmParameterizedTypeReference . class ) ; it . append ( " newTypeRef(String typeName)" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; it . append ( "\t\treturn this.builder.newTypeRef(typeName);" ) ; it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t/** Find the reference to the type with the given name." ) ; it . newLine ( ) ; it . append ( "\t * @param context the context for the type reference use" ) ; it . newLine ( ) ; it . append ( "\t * @param typeName the fully qualified name of the type" ) ; it . newLine ( ) ; it . append ( "\t * @return the type reference." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( JvmParameterizedTypeReference . class ) ; it . append ( " newTypeRef(" ) ; it . append ( Notifier . class ) ; it . append ( " context, String typeName)" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; it . append ( "\t\treturn this.builder.newTypeRef(context, typeName);" ) ; it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; } if ( forInterface ) { it . append ( "\t/** Replies the context for type resolution." ) ; it . newLine ( ) ; it . append ( "\t * @return the context or <code>null</code> if the Ecore object is the context." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t" ) ; it . append ( IJvmTypeProvider . class ) ; it . append ( " getTypeResolutionContext();" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; } else if ( forAppender ) { it . append ( "\tpublic " ) ; it . append ( IJvmTypeProvider . class ) ; it . append ( " getTypeResolutionContext() {" ) ; it . newLine ( ) ; it . append ( "\t\treturn this.builder.getTypeResolutionContext();" ) ; it . newLine ( ) ; it . append ( "\t}" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; } it . append ( "\t/** Initialize the expression." ) ; it . newLine ( ) ; it . append ( "\t * @param context the context of the expressions." ) ; it . newLine ( ) ; it . append ( "\t * @param setter the object that permits to assign the expression to the context." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( "void eInit(" ) ; it . append ( EObject . class ) ; it . append ( " context, " ) ; it . append ( Procedures . Procedure1 . class ) ; it . append ( "<? super " ) ; it . append ( XExpression . class ) ; it . append ( "> setter, " ) ; it . append ( IJvmTypeProvider . class ) ; it . append ( " typeContext)" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; if ( forAppender ) { it . append ( "\t\tthis.builder.eInit(context, setter, typeContext);" ) ; } else { it . append ( "\t\tsetTypeResolutionContext(typeContext);" ) ; it . newLine ( ) ; it . append ( "\t\tthis.context = context;" ) ; it . newLine ( ) ; it . append ( "\t\tthis.setter = setter;" ) ; it . newLine ( ) ; it . append ( "\t\tthis.expr = null;" ) ; } it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t/** Replies the last created expression." ) ; it . newLine ( ) ; it . append ( "\t *" ) ; it . newLine ( ) ; it . append ( "\t * @return the last created expression." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t@" ) ; it . append ( Pure . class ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( XExpression . class ) ; it . append ( " getXExpression()" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; if ( forAppender ) { it . append ( "\t\treturn this.builder.getXExpression();" ) ; } else { it . append ( "\t\treturn this.expr;" ) ; } it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t/** Replies the resource to which the XExpression is attached." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t@" ) ; it . append ( Pure . class ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( Resource . class ) ; it . append ( " eResource()" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; it . append ( "\t\treturn getXExpression().eResource();" ) ; it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t/** Change the expression in the container." ) ; it . newLine ( ) ; it . append ( "\t *" ) ; it . newLine ( ) ; it . append ( "\t * @param expression the textual representation of the expression." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( "void setExpression(String expression)" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; if ( forAppender ) { it . append ( "\t\tthis.builder.setExpression(expression);" ) ; } else { it . append ( "\t\tthis.expr = fromString(expression);" ) ; it . newLine ( ) ; it . append ( "\t\tthis.setter.apply(this.expr);" ) ; } it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t/** Change the expression in the container." ) ; it . newLine ( ) ; it . append ( "\t *" ) ; it . newLine ( ) ; it . append ( "\t * @param expression the expression." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( "void setXExpression(" ) ; it . append ( XExpression . class ) ; it . append ( " expression)" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; if ( forAppender ) { it . append ( "\t\tthis.builder.setXExpression(expression);" ) ; } else { it . append ( "\t\tthis.expr = expression;" ) ; it . newLine ( ) ; it . append ( "\t\tthis.setter.apply(this.expr);" ) ; } it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; if ( ! forInterface && ! forAppender ) { it . append ( "\t/** Generate a piece of " ) ; it . append ( getLanguageName ( ) ) ; it . append ( " code that permits to compile an XExpression." ) ; it . newLine ( ) ; it . append ( "\t *" ) ; it . newLine ( ) ; it . append ( "\t * @param expression the expression to compile." ) ; it . newLine ( ) ; it . append ( "\t * @return the " ) ; it . append ( getLanguageName ( ) ) ; it . append ( " code." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\tstatic String generateExpressionCode(String expression) {" ) ; it . newLine ( ) ; it . append ( "\t\treturn \"" ) ; it . append ( expressionContext . getContainerKeyword ( ) ) ; it . append ( " ____synthesis { " ) ; it . append ( expressionContext . getFieldDeclarationKeyword ( ) ) ; it . append ( " ____fakefield = \" + expression + \" }\";" ) ; it . newLine ( ) ; it . append ( "\t}" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\tstatic String generateTypenameCode(String typeName) {" ) ; it . newLine ( ) ; it . append ( "\t\treturn \"" ) ; it . append ( expressionContext . getContainerKeyword ( ) ) ; it . append ( " ____synthesis { " ) ; it . append ( expressionContext . getFieldDeclarationKeyword ( ) ) ; it . append ( " ____fakefield : \" + typeName + \" }\";" ) ; it . newLine ( ) ; it . append ( "\t}" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\tstatic " ) ; it . append ( JvmParameterizedTypeReference . class ) ; it . append ( " parseType(" ) ; it . append ( Notifier . class ) ; it . append ( " context, String typeName, " ) ; it . append ( getAbstractBuilderImpl ( ) ) ; it . append ( " caller) {" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; it . append ( ResourceSet . class ) ; it . append ( " resourceSet = toResource(context).getResourceSet();" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; it . append ( URI . class ) ; it . append ( " uri = caller.computeUnusedUri(resourceSet);" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; it . append ( Resource . class ) ; it . append ( " resource = caller.getResourceFactory().createResource(uri);" ) ; it . newLine ( ) ; it . append ( "\t\tresourceSet.getResources().add(resource);" ) ; it . newLine ( ) ; it . append ( "\t\ttry (" ) ; it . append ( StringInputStream . class ) ; it . append ( " is = new " ) ; it . append ( StringInputStream . class ) ; it . append ( "(generateTypenameCode(typeName))) {" ) ; it . newLine ( ) ; it . append ( "\t\t\tresource.load(is, null);" ) ; it . newLine ( ) ; it . append ( "\t\t\t" ) ; it . append ( getCodeElementExtractor ( ) . getLanguageScriptInterface ( ) ) ; it . append ( " script = resource.getContents().isEmpty() ? null : (" ) ; it . append ( getCodeElementExtractor ( ) . getLanguageScriptInterface ( ) ) ; it . append ( ") resource.getContents().get(0);" ) ; it . newLine ( ) ; it . append ( "\t\t\t" ) ; it . append ( expressionContext . getContainerDescription ( ) . getElementType ( ) ) ; it . append ( " topElement = (" ) ; it . append ( expressionContext . getContainerDescription ( ) . getElementType ( ) ) ; it . append ( ") script." ) ; it . append ( getLanguageScriptMemberGetter ( ) ) ; it . append ( "().get(0);" ) ; it . newLine ( ) ; it . append ( "\t\t\t" ) ; it . append ( expressionContext . getMemberDescription ( ) . getElementType ( ) ) ; it . append ( " member = (" ) ; it . append ( expressionContext . getMemberDescription ( ) . getElementType ( ) ) ; it . append ( ") topElement.get" ) ; it . append ( Strings . toFirstUpper ( getCodeBuilderConfig ( ) . getMemberCollectionExtensionGrammarName ( ) ) ) ; it . append ( "().get(0);" ) ; it . newLine ( ) ; it . append ( "\t\t\t" ) ; it . append ( JvmTypeReference . class ) ; it . append ( " reference = member.getType();" ) ; it . newLine ( ) ; it . append ( "\t\t\tif (reference instanceof " ) ; it . append ( JvmParameterizedTypeReference . class ) ; it . append ( ") {" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tfinal " ) ; it . append ( JvmParameterizedTypeReference . class ) ; it . append ( " pref = (" ) ; it . append ( JvmParameterizedTypeReference . class ) ; it . append ( ") reference;" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tif (!pref.getArguments().isEmpty()) {" ) ; it . newLine ( ) ; it . append ( "\t\t\t\t\t" ) ; it . append ( EcoreUtil2 . class ) ; it . append ( ".resolveAll(resource);" ) ; it . newLine ( ) ; it . append ( "\t\t\t\t\treturn pref;" ) ; it . newLine ( ) ; it . append ( "\t\t\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\t} catch (" ) ; it . append ( Exception . class ) ; it . append ( " exception) {" ) ; it . newLine ( ) ; it . append ( "\t\t\tthrow new " ) ; it . append ( TypeNotPresentException . class ) ; it . append ( "(typeName, exception);" ) ; it . newLine ( ) ; it . append ( "\t\t} finally {" ) ; it . newLine ( ) ; it . append ( "\t\t\tresourceSet.getResources().remove(resource);" ) ; it . newLine ( ) ; it . append ( "\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\tthrow new " ) ; it . append ( TypeNotPresentException . class ) ; it . append ( "(typeName, null);" ) ; it . newLine ( ) ; it . append ( "\t}" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t/** Create an expression but does not change the container." ) ; it . newLine ( ) ; it . append ( "\t *" ) ; it . newLine ( ) ; it . append ( "\t * @param expression the textual representation of the expression." ) ; it . newLine ( ) ; it . append ( "\t * @return the expression." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t@" ) ; it . append ( Pure . class ) ; it . newLine ( ) ; it . append ( "\tprotected " ) ; it . append ( XExpression . class ) ; it . append ( " fromString(String expression)" ) ; it . append ( " {" ) ; it . newLine ( ) ; it . append ( "\t\tif (!" ) ; it . append ( Strings . class ) ; it . append ( ".isEmpty(expression)) {" ) ; it . newLine ( ) ; it . append ( "\t\t\t" ) ; it . append ( ResourceSet . class ) ; it . append ( " resourceSet = this.context.eResource().getResourceSet();" ) ; it . newLine ( ) ; it . append ( "\t\t\t" ) ; it . append ( URI . class ) ; it . append ( " uri = computeUnusedUri(resourceSet);" ) ; it . newLine ( ) ; it . append ( "\t\t\t" ) ; it . append ( Resource . class ) ; it . append ( " resource = getResourceFactory().createResource(uri);" ) ; it . newLine ( ) ; it . append ( "\t\t\tresourceSet.getResources().add(resource);" ) ; it . newLine ( ) ; it . append ( "\t\t\ttry (" ) ; it . append ( StringInputStream . class ) ; it . append ( " is = new " ) ; it . append ( StringInputStream . class ) ; it . append ( "(generateExpressionCode(expression))) {" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tresource.load(is, null);" ) ; it . newLine ( ) ; it . append ( "\t\t\t\t" ) ; it . append ( getCodeElementExtractor ( ) . getLanguageScriptInterface ( ) ) ; it . append ( " script = resource.getContents().isEmpty() ? null : (" ) ; it . append ( getCodeElementExtractor ( ) . getLanguageScriptInterface ( ) ) ; it . append ( ") resource.getContents().get(0);" ) ; it . newLine ( ) ; it . append ( "\t\t\t\t" ) ; it . append ( expressionContext . getContainerDescription ( ) . getElementType ( ) ) ; it . append ( " topElement = (" ) ; it . append ( expressionContext . getContainerDescription ( ) . getElementType ( ) ) ; it . append ( ") script." ) ; it . append ( getLanguageScriptMemberGetter ( ) ) ; it . append ( "().get(0);" ) ; it . newLine ( ) ; it . append ( "\t\t\t\t" ) ; it . append ( expressionContext . getMemberDescription ( ) . getElementType ( ) ) ; it . append ( " member = (" ) ; it . append ( expressionContext . getMemberDescription ( ) . getElementType ( ) ) ; it . append ( ") topElement.get" ) ; it . append ( Strings . toFirstUpper ( getCodeBuilderConfig ( ) . getMemberCollectionExtensionGrammarName ( ) ) ) ; it . append ( "().get(0);" ) ; it . newLine ( ) ; it . append ( "\t\t\t\treturn member.get" ) ; it . append ( Strings . toFirstUpper ( expressionContext . getExpressionAssignment ( ) . getFeature ( ) ) ) ; it . append ( "();" ) ; it . newLine ( ) ; it . append ( "\t\t\t} catch (Throwable exception) {" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tthrow new RuntimeException(exception);" ) ; it . newLine ( ) ; it . append ( "\t\t\t} finally {" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tresourceSet.getResources().remove(resource);" ) ; it . newLine ( ) ; it . append ( "\t\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\tthrow new IllegalArgumentException(\"not a valid expression\");" ) ; it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t/** Replies the XExpression for the default value associated to the given type." ) ; it . newLine ( ) ; it . append ( "\t * @param type the type for which the default value should be determined." ) ; it . newLine ( ) ; it . append ( "\t * @return the default value." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t@" ) ; it . append ( Pure . class ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( XExpression . class ) ; it . append ( " getDefaultXExpressionForType(String type)" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; if ( forAppender ) { it . append ( "\t\treturn this.builder.getDefaultXExpressionForType(type);" ) ; } else { it . append ( "\t\t//TODO: Check if a similar function exists in the Xbase library." ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; it . append ( XExpression . class ) ; it . append ( " expr = null;" ) ; it . newLine ( ) ; it . append ( "\t\tif (type != null && !\"void\".equals(type) && !Void.class.getName().equals(type)) {" ) ; it . newLine ( ) ; it . append ( "\t\t\tswitch (type) {" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"boolean\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.Boolean\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\t" ) ; it . append ( XBooleanLiteral . class ) ; it . append ( " booleanLiteral = " ) ; it . append ( XbaseFactory . class ) ; it . append ( ".eINSTANCE.createXBooleanLiteral();" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbooleanLiteral.setIsTrue(false);" ) ; it . newLine ( ) ; it . append ( "\t\t\t\texpr = booleanLiteral;" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"float\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.Float\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\t" ) ; it . append ( XNumberLiteral . class ) ; it . append ( " numberLiteral = " ) ; it . append ( XbaseFactory . class ) ; it . append ( ".eINSTANCE.createXNumberLiteral();" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tnumberLiteral.setValue(\"0.0f\");" ) ; it . newLine ( ) ; it . append ( "\t\t\t\texpr = numberLiteral;" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"double\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.Double\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.BigDecimal\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tnumberLiteral = " ) ; it . append ( XbaseFactory . class ) ; it . append ( ".eINSTANCE.createXNumberLiteral();" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tnumberLiteral.setValue(\"0.0\");" ) ; it . newLine ( ) ; it . append ( "\t\t\t\texpr = numberLiteral;" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"int\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"long\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.Integer\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.Long\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.BigInteger\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tnumberLiteral = " ) ; it . append ( XbaseFactory . class ) ; it . append ( ".eINSTANCE.createXNumberLiteral();" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tnumberLiteral.setValue(\"0\");" ) ; it . newLine ( ) ; it . append ( "\t\t\t\texpr = numberLiteral;" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"byte\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"short\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"char\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.Byte\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.Short\":" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"java.lang.Character\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tnumberLiteral = " ) ; it . append ( XbaseFactory . class ) ; it . append ( ".eINSTANCE.createXNumberLiteral();" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tnumberLiteral.setValue(\"0\");" ) ; it . newLine ( ) ; it . append ( "\t\t\t\t" ) ; it . append ( XCastedExpression . class ) ; it . append ( " castExpression = " ) ; it . append ( XbaseFactory . class ) ; it . append ( ".eINSTANCE.createXCastedExpression();" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tcastExpression.setTarget(numberLiteral);" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tcastExpression.setType(newTypeRef(this.context, type));" ) ; it . newLine ( ) ; it . append ( "\t\t\t\texpr = numberLiteral;" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tdefault:" ) ; it . newLine ( ) ; it . append ( "\t\t\t\texpr = " ) ; it . append ( XbaseFactory . class ) ; it . append ( ".eINSTANCE.createXNullLiteral();" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\treturn expr;" ) ; } it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t/** Replies the default value for the given type." ) ; it . newLine ( ) ; it . append ( "\t * @param type the type for which the default value should be determined." ) ; it . newLine ( ) ; it . append ( "\t * @return the default value." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t@" ) ; it . append ( Pure . class ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( "String getDefaultValueForType(String type)" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; if ( forAppender ) { it . append ( "\t\treturn this.builder.getDefaultValueForType(type);" ) ; } else { it . append ( "\t\t//TODO: Check if a similar function exists in the Xbase library." ) ; it . newLine ( ) ; it . append ( "\t\tString defaultValue = \"\";" ) ; it . newLine ( ) ; it . append ( "\t\tif (!" ) ; it . append ( Strings . class ) ; it . append ( ".isEmpty(type) && !\"void\".equals(type)) {" ) ; it . newLine ( ) ; it . append ( "\t\t\tswitch (type) {" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"boolean\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tdefaultValue = \"true\";" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"double\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tdefaultValue = \"0.0\";" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"float\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tdefaultValue = \"0.0f\";" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"int\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tdefaultValue = \"0\";" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"long\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tdefaultValue = \"0\";" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"byte\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tdefaultValue = \"(0 as byte)\";" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"short\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tdefaultValue = \"(0 as short)\";" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tcase \"char\":" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tdefaultValue = \"(0 as char)\";" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\tdefault:" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tdefaultValue = \"null\";" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tbreak;" ) ; it . newLine ( ) ; it . append ( "\t\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\treturn defaultValue;" ) ; } it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( generateStandardCommentFunctions ( forInterface , forAppender , "getXExpression()" ) ) ; if ( ! forInterface ) { it . append ( "\t@" ) ; it . append ( Override . class ) ; it . newLine ( ) ; it . append ( "\t@" ) ; it . append ( Pure . class ) ; it . newLine ( ) ; it . append ( "\tpublic " ) ; it . append ( String . class ) ; it . append ( " toString() {" ) ; it . newLine ( ) ; it . append ( "\t\treturn " ) ; if ( forAppender ) { it . append ( "this.builder.toString();" ) ; } else { it . append ( EmfFormatter . class ) ; it . append ( ".objToStr(getXExpression());" ) ; } it . newLine ( ) ; it . append ( "\t}" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; } it . append ( "\t/** Create a reference to \"this\" object or to the current type." ) ; it . newLine ( ) ; it . append ( "\t *" ) ; it . newLine ( ) ; it . append ( "\t * @return the reference." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( XFeatureCall . class ) ; it . append ( " createReferenceToThis()" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; if ( forAppender ) { it . append ( "return this.builder.createReferenceToThis();" ) ; } else { it . append ( "final " ) ; it . append ( XExpression . class ) ; it . append ( " expr = getXExpression();" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; it . append ( XtendTypeDeclaration . class ) ; it . append ( " type = " ) ; it . append ( EcoreUtil2 . class ) ; it . append ( ".getContainerOfType(expr, " ) ; it . append ( XtendTypeDeclaration . class ) ; it . append ( ".class);" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; it . append ( JvmType . class ) ; it . append ( " jvmObject = getAssociatedElement(" ) ; it . append ( JvmType . class ) ; it . append ( ".class, type, expr.eResource());" ) ; it . newLine ( ) ; it . append ( "\t\tfinal " ) ; it . append ( XFeatureCall . class ) ; it . append ( " thisFeature = " ) ; it . append ( XbaseFactory . class ) ; it . append ( ".eINSTANCE.createXFeatureCall();" ) ; it . newLine ( ) ; it . append ( "\t\tthisFeature.setFeature(jvmObject);" ) ; it . newLine ( ) ; it . append ( "\t\treturn thisFeature;" ) ; } it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t/** Create a reference to \"super\" object or to the super type." ) ; it . newLine ( ) ; it . append ( "\t *" ) ; it . newLine ( ) ; it . append ( "\t * @return the reference." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\t" ) ; if ( ! forInterface ) { it . append ( "public " ) ; } it . append ( XFeatureCall . class ) ; it . append ( " createReferenceToSuper()" ) ; if ( forInterface ) { it . append ( ";" ) ; } else { it . append ( " {" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; if ( forAppender ) { it . append ( "return this.builder.createReferenceToSuper();" ) ; } else { it . append ( "final " ) ; it . append ( XExpression . class ) ; it . append ( " expr = getXExpression();" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; it . append ( XtendTypeDeclaration . class ) ; it . append ( " type = " ) ; it . append ( EcoreUtil2 . class ) ; it . append ( ".getContainerOfType(expr, " ) ; it . append ( XtendTypeDeclaration . class ) ; it . append ( ".class);" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; it . append ( JvmType . class ) ; it . append ( " jvmObject = getAssociatedElement(" ) ; it . append ( JvmType . class ) ; it . append ( ".class, type, expr.eResource());" ) ; it . newLine ( ) ; it . append ( "\t\tfinal " ) ; it . append ( XFeatureCall . class ) ; it . append ( " superFeature = " ) ; it . append ( XbaseFactory . class ) ; it . append ( ".eINSTANCE.createXFeatureCall();" ) ; it . newLine ( ) ; it . append ( "\t\t" ) ; it . append ( JvmIdentifiableElement . class ) ; it . append ( " feature;" ) ; it . newLine ( ) ; it . append ( "\t\tif (jvmObject instanceof " ) ; it . append ( JvmDeclaredType . class ) ; it . append ( ") {" ) ; it . newLine ( ) ; it . append ( "\t\t\tfeature = ((" ) ; it . append ( JvmDeclaredType . class ) ; it . append ( ") jvmObject).getExtendedClass().getType();" ) ; it . newLine ( ) ; it . append ( "\t\t} else {" ) ; it . newLine ( ) ; it . append ( "\t\t\tfeature = findType(expr, getQualifiedName(type)).getType();" ) ; it . newLine ( ) ; it . append ( "\t\t\tif (feature instanceof " ) ; it . append ( JvmDeclaredType . class ) ; it . append ( ") {" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tfeature = ((" ) ; it . append ( JvmDeclaredType . class ) ; it . append ( ") feature).getExtendedClass().getType();" ) ; it . newLine ( ) ; it . append ( "\t\t\t} else {" ) ; it . newLine ( ) ; it . append ( "\t\t\t\tfeature = null;" ) ; it . newLine ( ) ; it . append ( "\t\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\tif (feature == null) {" ) ; it . newLine ( ) ; it . append ( "\t\t\treturn null;" ) ; it . newLine ( ) ; it . append ( "\t\t}" ) ; it . newLine ( ) ; it . append ( "\t\tsuperFeature.setFeature(feature);" ) ; it . newLine ( ) ; it . append ( "\t\treturn superFeature;" ) ; } it . newLine ( ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; it . append ( "\t}" ) ; } it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; if ( forInterface ) { it . append ( "\t/** Dispose the resource." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\tvoid dispose();" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; } else if ( forAppender ) { it . append ( "\t/** Dispose the resource." ) ; it . newLine ( ) ; it . append ( "\t */" ) ; it . newLine ( ) ; it . append ( "\tpublic void dispose() {" ) ; it . newLine ( ) ; it . append ( "\t\tthis.builder.dispose();" ) ; it . newLine ( ) ; it . append ( "\t}" ) ; it . newLineIfNotEmpty ( ) ; it . newLine ( ) ; } } } ; }
Generate the members of the builder.

@param forInterface <code>true</code> if the code must be generated for an interface.
@param forAppender <code>true</code> if the code must be generated for an appender.
@return the code.