All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jnario.spec.SpecRuntimeModule Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright (c) 2012 BMW Car IT and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
/*
 * generated by Xtext
 */
package org.jnario.spec;


import org.eclipse.xtend.core.compiler.UnicodeAwarePostProcessor;
import org.eclipse.xtend.core.compiler.XtendGenerator;
import org.eclipse.xtend.core.compiler.XtendOutputConfigurationProvider;
import org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler;
import org.eclipse.xtend.core.formatting.XtendFormatter;
import org.eclipse.xtend.core.imports.XtendImportsConfiguration;
import org.eclipse.xtend.core.jvmmodel.IXtendJvmAssociations;
import org.eclipse.xtend.core.jvmmodel.SyntheticNameClashResolver;
import org.eclipse.xtend.core.linking.LinkingProxyAwareResource;
import org.eclipse.xtend.core.linking.URIEncoder;
import org.eclipse.xtend.core.linking.XtendEObjectAtOffsetHelper;
import org.eclipse.xtend.core.linking.XtendLinkingDiagnosticMessageProvider;
import org.eclipse.xtend.core.parser.antlr.internal.FlexerFactory;
import org.eclipse.xtend.core.resource.XtendLocationInFileProvider;
import org.eclipse.xtend.core.resource.XtendResourceDescriptionManager;
import org.eclipse.xtend.core.scoping.AnonymousClassConstructorScopes;
import org.eclipse.xtend.core.typesystem.LocalClassAwareTypeNames;
import org.eclipse.xtend.core.typesystem.TypeDeclarationAwareBatchTypeResolver;
import org.eclipse.xtend.core.validation.XtendConfigurableIssueCodes;
import org.eclipse.xtend.core.validation.XtendEarlyExitValidator;
import org.eclipse.xtend.core.validation.XtendImplicitReturnFinder;
import org.eclipse.xtend.core.xtend.XtendFactory;
import org.eclipse.xtend.lib.macro.file.FileLocations;
import org.eclipse.xtend.lib.macro.file.MutableFileSystemSupport;
import org.eclipse.xtext.common.types.descriptions.JvmDeclaredTypeSignatureHashProvider.SignatureHashBuilder;
import org.eclipse.xtext.conversion.IValueConverterService;
import org.eclipse.xtext.conversion.impl.IDValueConverter;
import org.eclipse.xtext.documentation.IEObjectDocumentationProvider;
import org.eclipse.xtext.generator.IFilePostProcessor;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.generator.IOutputConfigurationProvider;
import org.eclipse.xtext.generator.JavaIoFileSystemAccess;
import org.eclipse.xtext.generator.OutputConfigurationProvider;
import org.eclipse.xtext.linking.ILinker;
import org.eclipse.xtext.linking.ILinkingDiagnosticMessageProvider;
import org.eclipse.xtext.linking.ILinkingService;
import org.eclipse.xtext.linking.lazy.LazyURIEncoder;
import org.eclipse.xtext.naming.IQualifiedNameProvider;
import org.eclipse.xtext.parser.IParser;
import org.eclipse.xtext.resource.EObjectAtOffsetHelper;
import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy;
import org.eclipse.xtext.resource.ILocationInFileProvider;
import org.eclipse.xtext.resource.IResourceDescription.Manager;
import org.eclipse.xtext.resource.IResourceDescriptions;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.resource.impl.EagerResourceSetBasedResourceDescriptions;
import org.eclipse.xtext.scoping.IScopeProvider;
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.validation.CompositeEValidator;
import org.eclipse.xtext.validation.ConfigurableIssueCodesProvider;
import org.eclipse.xtext.validation.IResourceValidator;
import org.eclipse.xtext.xbase.XbaseFactory;
import org.eclipse.xtext.xbase.compiler.JvmModelGenerator;
import org.eclipse.xtext.xbase.compiler.XbaseCompiler;
import org.eclipse.xtext.xbase.compiler.output.TraceAwarePostProcessor;
import org.eclipse.xtext.xbase.file.AbstractFileSystemSupport;
import org.eclipse.xtext.xbase.file.FileLocationsImpl;
import org.eclipse.xtext.xbase.file.JavaIOFileSystemSupport;
import org.eclipse.xtext.xbase.file.RuntimeWorkspaceConfigProvider;
import org.eclipse.xtext.xbase.file.WorkspaceConfig;
import org.eclipse.xtext.xbase.formatting.IBasicFormatter;
import org.eclipse.xtext.xbase.formatting.NodeModelAccess;
import org.eclipse.xtext.xbase.imports.IImportsConfiguration;
import org.eclipse.xtext.xbase.jvmmodel.IJvmModelInferrer;
import org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator;
import org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder;
import org.eclipse.xtext.xbase.scoping.batch.ConstructorScopes;
import org.eclipse.xtext.xbase.scoping.batch.ImplicitlyImportedFeatures;
import org.eclipse.xtext.xbase.scoping.batch.XbaseBatchScopeProvider;
import org.eclipse.xtext.xbase.typesystem.computation.ITypeComputer;
import org.eclipse.xtext.xbase.typesystem.internal.DefaultBatchTypeResolver;
import org.eclipse.xtext.xbase.typesystem.internal.DefaultReentrantTypeResolver;
import org.eclipse.xtext.xbase.typesystem.util.HumanReadableTypeNames;
import org.eclipse.xtext.xbase.util.XExpressionHelper;
import org.eclipse.xtext.xbase.validation.EarlyExitValidator;
import org.eclipse.xtext.xbase.validation.ImplicitReturnFinder;
import org.jnario.compiler.JnarioCompiler;
import org.jnario.compiler.JnarioExpressionHelper;
import org.jnario.conversion.JnarioJavaIDValueConverter;
import org.jnario.doc.AbstractDocGenerator;
import org.jnario.doc.DocOutputConfigurationProvider;
import org.jnario.documentation.XtendDocumentationProvider;
import org.jnario.formatter.JnarioNodeModelAccess;
import org.jnario.generator.JnarioJavaIoFileSystemAccess;
import org.jnario.jvmmodel.ExecutableProvider;
import org.jnario.jvmmodel.ExtendedJvmTypesBuilder;
import org.jnario.jvmmodel.JnarioNameProvider;
import org.jnario.jvmmodel.JnarioSignatureHashBuilder;
import org.jnario.linking.JnarioLinkingService;
import org.jnario.report.Executable2ResultMapping;
import org.jnario.report.HashBasedSpec2ResultMapping;
import org.jnario.scoping.JnarioImplicitlyImportedFeatures;
import org.jnario.spec.compiler.SpecBatchCompiler;
import org.jnario.spec.conversion.SpecValueConverterService;
import org.jnario.spec.doc.SpecDocGenerator;
import org.jnario.spec.formatting.SpecFormatter;
import org.jnario.spec.jvmmodel.SpecExecutableProvider;
import org.jnario.spec.jvmmodel.SpecJvmModelGenerator;
import org.jnario.spec.jvmmodel.SpecJvmModelInferrer;
import org.jnario.spec.jvmmodel.SpecLazyLinker;
import org.jnario.spec.jvmmodel.SpecSyntheticNameClashResolver;
import org.jnario.spec.naming.ExampleNameProvider;
import org.jnario.spec.naming.SpecQualifiedNameProvider;
import org.jnario.spec.scoping.SpecBatchScopeProvider;
import org.jnario.spec.scoping.SpecImportedNamespaceScopeProvider;
import org.jnario.spec.scoping.SpecResourceDescriptionStrategy;
import org.jnario.typing.JnarioTypeComputer;
import org.jnario.typing.JnarioTypeResolver;

import com.google.inject.Binder;
import com.google.inject.Scopes;
import com.google.inject.name.Names;

/**
 * @author Sebastian Benz - Initial contribution and API
 */
@SuppressWarnings("restriction")
public class SpecRuntimeModule extends org.jnario.spec.AbstractSpecRuntimeModule {

	@Override
	public void configure(Binder binder) {
		super.configure(binder);
		binder.bind(FlexerFactory.class).in(Scopes.SINGLETON);
		binder.bind(AbstractDocGenerator.class).to(SpecDocGenerator.class);
		binder.bind(SignatureHashBuilder.class).to(JnarioSignatureHashBuilder.class);
		binder.bind(SyntheticNameClashResolver.class).to(SpecSyntheticNameClashResolver.class);
		binder.bind(JnarioNameProvider.class).to(ExampleNameProvider.class);
		binder.bind(ExecutableProvider.class).to(SpecExecutableProvider.class);
		binder.bind(Executable2ResultMapping.class).to(HashBasedSpec2ResultMapping.class);
		binder.bind(ImplicitlyImportedFeatures.class).to(JnarioImplicitlyImportedFeatures.class);
		binder.bind(boolean.class).annotatedWith(
				Names.named(CompositeEValidator.USE_EOBJECT_VALIDATOR)).toInstance(false);
		binder.bind(XtendBatchCompiler.class).to(SpecBatchCompiler.class);
	}
	
	public Class bindJvmTypesBuilder(){
		return ExtendedJvmTypesBuilder.class;
	}
	
	public Class bindJvmModelGenerator(){
		return SpecJvmModelGenerator.class;
	}

	public Class bindOutputConfigurationProvider() {
		return DocOutputConfigurationProvider.class;
	}
	
	public Class bindPostProcessor() {
		return TraceAwarePostProcessor.class;
	}
	
	@Override
	public Class bindILinkingService() {
		return JnarioLinkingService.class;
	}
	
	public Class bindJavaIoFileSystemAccess() {
		return JnarioJavaIoFileSystemAccess.class;
	}
	
	public Class bindJnarioBatchCompiler(){
		return SpecBatchCompiler.class;
	}
	
	public XbaseFactory bindXbaseFactory() {
		return XbaseFactory.eINSTANCE;
	}
	
	@Override
	public Class bindXbaseBatchScopeProvider() {
		return SpecBatchScopeProvider.class;
	}
	
	/**********************************************************************/
	
	public Class bindXExpressionHelper() {
		return JnarioExpressionHelper.class;
	}
	
	@Override
	public Class bindIValueConverterService() {
		return SpecValueConverterService.class;
	}
	
	@Override
	public void configureIScopeProviderDelegate(Binder binder) {
		binder.bind(IScopeProvider.class).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
			.to(SpecImportedNamespaceScopeProvider.class);
	}

	@Override
	public Class bindIQualifiedNameProvider() {
		return SpecQualifiedNameProvider.class;
	}
	
	@Override
	public Class  bindIDefaultResourceDescriptionStrategy() {
		return SpecResourceDescriptionStrategy.class;
	}

	public Class bindJvmModelAssociator() {
		return IXtendJvmAssociations.Impl.class;
	}

	public Class bindEarlyExitValidator() {
		return XtendEarlyExitValidator.class;
	}
	
	public Class bindIOutputConfigurationProvider() {
		return XtendOutputConfigurationProvider.class;
	}
	
	@Override
	public Class bindILocationInFileProvider() {
		return XtendLocationInFileProvider.class;
	}

	@Override
	public Class bindILinkingDiagnosticMessageProvider() {
		return XtendLinkingDiagnosticMessageProvider.class;
	}
	
	public Class bindIBasicFormatter() {
		return SpecFormatter.class;
	}

	public Class bindIImportsConfiguration() {
		return XtendImportsConfiguration.class;
	}

	@Override
	public Class bindConfigurableIssueCodesProvider() {
		return XtendConfigurableIssueCodes.class;
	}
	
	public XtendFactory bindXtendFactory() {
		return XtendFactory.eINSTANCE;
	}

	@Override
	public Class bindDefaultBatchTypeResolver() {
		return TypeDeclarationAwareBatchTypeResolver.class;
	}

	@Override
	public Class bindDefaultReentrantTypeResolver() {
		return JnarioTypeResolver.class;
	}
	
	public Class bindXbaseCompiler() {
		return JnarioCompiler.class;
	}
	
	public Class bindTraceAwarePostProcessor() {
		return UnicodeAwarePostProcessor.class;
	}

	@Override
	public Class bindITypeComputer() {
		return JnarioTypeComputer.class;
	}

	public Class bindIJvmModelInferrer() {
		return SpecJvmModelInferrer.class;
	}
	
	@Override
	public Class bindIResourceDescription$Manager() {
		return XtendResourceDescriptionManager.class;
	}
	
	@Override
	public Class bindIResourceValidator() {
		return org.eclipse.xtend.core.validation.CachingResourceValidatorImpl.class;
	}
	
	@Override
	public Class bindILinker() {
		return SpecLazyLinker.class;
	}
	
	@Override
	public Class bindXtextResource() {
		return LinkingProxyAwareResource.class;
	}
	
	public Class bindLazyURIEncoder() {
		return URIEncoder.class;
	}
	
	/**
	 * @since 2.4.2
	 */
	@Override
	public void configureIResourceDescriptions(com.google.inject.Binder binder) {
		binder.bind(IResourceDescriptions.class).to(EagerResourceSetBasedResourceDescriptions.class);
	}
	
	public Class bindFileHandleFactory() {
		return AbstractFileSystemSupport.class;
	}
	
	public Class bindAbstractFileSystemSupport() {
		return JavaIOFileSystemSupport.class;
	}
	
	@Override
	public Class bindIGenerator() {
		return XtendGenerator.class;
	}
	
	public void configureWorkspaceConfigContribution(Binder binder) {
		binder.bind(WorkspaceConfig.class).toProvider(RuntimeWorkspaceConfigProvider.class);
	}
	
	public Class bindFileLocations() {
		return FileLocationsImpl.class;
	}
	
	public Class bindIEObjectDocumentationProvider() {
		return XtendDocumentationProvider.class;
	}
	
	@Override
	public Class bindIParser() {
		return SpecParserWithoutPartialParsing.class;
	}
	
	public Class bindIDValueConverter() {
		return JnarioJavaIDValueConverter.class;
	}
	
	public Class bindNodeModelAccess(){
		return JnarioNodeModelAccess.class;
	}
	

	@Override
	public Class bindEObjectAtOffsetHelper() {
		return XtendEObjectAtOffsetHelper.class;
	}
	
	public Class bindImplicitRetrnFinder() {
		return XtendImplicitReturnFinder.class;
	}
	
	public Class bindHumanReadableTypeNames() {
		return LocalClassAwareTypeNames.class;
	}
	
	public Class bindConstructorScopes() {
		return AnonymousClassConstructorScopes.class;
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy