/*
* $Id$
*
* File is automatically generated by the Xtext language generator.
* Do not change it.
*
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-2017 the original authors or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.sarl.lang.codebuilder.appenders;
import io.sarl.lang.codebuilder.builders.IExpressionBuilder;
import io.sarl.lang.codebuilder.builders.IFormalParameterBuilder;
import io.sarl.lang.sarl.SarlFormalParameter;
import java.io.IOException;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtend.core.xtend.XtendExecutable;
import org.eclipse.xtext.common.types.JvmParameterizedTypeReference;
import org.eclipse.xtext.common.types.access.IJvmTypeProvider;
import org.eclipse.xtext.xbase.XFeatureCall;
import org.eclipse.xtext.xbase.compiler.ISourceAppender;
import org.eclipse.xtext.xbase.lib.Pure;
/** Appender of a Sarl formal parameter.
*/
@SuppressWarnings("all")
public class FormalParameterSourceAppender extends AbstractSourceAppender implements IFormalParameterBuilder {
private final IFormalParameterBuilder builder;
public FormalParameterSourceAppender(IFormalParameterBuilder builder) {
this.builder = builder;
}
public void build(ISourceAppender appender) throws IOException {
build(this.builder.getSarlFormalParameter(), appender);
}
/** Find the reference to the type with the given name.
* @param typeName the fully qualified name of the type
* @return the type reference.
*/
public JvmParameterizedTypeReference newTypeRef(String typeName) {
return this.builder.newTypeRef(typeName);
}
/** Find the reference to the type with the given name.
* @param context the context for the type reference use
* @param typeName the fully qualified name of the type
* @return the type reference.
*/
public JvmParameterizedTypeReference newTypeRef(Notifier context, String typeName) {
return this.builder.newTypeRef(context, typeName);
}
public IJvmTypeProvider getTypeResolutionContext() {
return this.builder.getTypeResolutionContext();
}
/** Initialize the formal parameter.
* @param context - the context of the formal parameter.
* @param name - the name of the formal parameter.
*/
public void eInit(XtendExecutable context, String name, IJvmTypeProvider typeContext) {
this.builder.eInit(context, name, typeContext);
}
/** Replies the created parameter.
*
* @return the parameter.
*/
@Pure
public SarlFormalParameter getSarlFormalParameter() {
return this.builder.getSarlFormalParameter();
}
/** Replies the JvmIdentifiable that corresponds to the formal parameter.
*
* @param container the feature call that is supposed to contains the replied identifiable element.
*/
public void setReferenceInto(XFeatureCall container) {
this.builder.setReferenceInto(container);
}
/** Replies the resource to which the formal parameter is attached.
*/
@Pure
public Resource eResource() {
return getSarlFormalParameter().eResource();
}
/** Change the type.
*
* @param type the formal parameter type.
*/
public void setParameterType(String type) {
this.builder.setParameterType(type);
}
/** Change the variadic property of the parameter.
*
* @param isVariadic indicates if the parameter is variadic.
*/
public void setVarArg(boolean isVariadic) {
this.builder.setVarArg(isVariadic);
}
/** Replies the default value of the parameter.
* @return the default value builder.
*/
@Pure
public IExpressionBuilder getDefaultValue() {
return this.builder.getDefaultValue();
}
/** Dispose the resource.
*/
public void dispose() {
this.builder.dispose();
}
}