当前位置: 首页>>代码示例>>Java>>正文


Java Serializer类代码示例

本文整理汇总了Java中org.eclipse.xtext.serializer.impl.Serializer的典型用法代码示例。如果您正苦于以下问题:Java Serializer类的具体用法?Java Serializer怎么用?Java Serializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Serializer类属于org.eclipse.xtext.serializer.impl包,在下文中一共展示了Serializer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.eclipse.xtext.serializer.impl.Serializer; //导入依赖的package包/类
public static void main(String[] args) {
	// Getting the serializer
	GExpressionsStandaloneSetup setup = new GExpressionsStandaloneSetup();
	Injector injector = setup.createInjectorAndDoEMFRegistration();
	Serializer serializer = injector.getInstance(Serializer.class);

	// Creating a model
	GexpressionsFactory factory = GexpressionsFactory.eINSTANCE;
	GAdditionExpression exp = factory.createGAdditionExpression();
	GIntegerExpression un = factory.createGIntegerExpression();
	un.setValue(1);
	GStringExpression deux = factory.createGStringExpression();
	deux.setValue("deux");
	exp.setLeftOperand(un);
	exp.setRightOperand(deux);

	// Serializing
	String s = serializer.serialize(exp);
	System.out.println(s);
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:21,代码来源:TestXtextSerializer.java

示例2: loadGexpressionTestFile

import org.eclipse.xtext.serializer.impl.Serializer; //导入依赖的package包/类
public static void loadGexpressionTestFile() {
	// Getting the serializer
	GExpressionsStandaloneSetup setup = new GExpressionsStandaloneSetup();
	Injector injector = setup.createInjectorAndDoEMFRegistration();
	GexpressionsPackage.eINSTANCE.eClass();
	Serializer serializer = injector.getInstance(Serializer.class);

	// Load the model
	URI modelURI = URI
			.createFileURI("/home/flatombe/thesis/gemoc/git/gemoc-dev/org/eclipse/gemoc/GEL/org.eclipse.gemoc.gel.gexpressions.test/model/test.gexpressions");
	XtextResourceSet resSet = injector.getInstance(XtextResourceSet.class);
	resSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
	Resource resource = resSet.getResource(modelURI, true);
	GProgram program = (GProgram) resource.getContents().get(0);

	List<GExpression> exps = program.getExpressions();
	for (GExpression exp : exps) {
		// Serializing
		String s = serializer.serialize(exp);
		System.out.println(s);
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:23,代码来源:TestXtextSerializer2.java

示例3: generate

import org.eclipse.xtext.serializer.impl.Serializer; //导入依赖的package包/类
@Override
public void generate() {
  new GuiceModuleAccess.BindingFactory().addTypeToType(TypeReference.typeRef(ISemanticSequencer.class), this.getSemanticSequencerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ISyntacticSequencer.class), this.getSyntacticSequencerClass(this.getGrammar())).addTypeToType(TypeReference.typeRef(ISerializer.class), TypeReference.typeRef(Serializer.class)).contributeTo(this.getLanguage().getRuntimeGenModule());
  ManifestAccess _manifest = this.getProjectConfig().getRuntime().getManifest();
  boolean _tripleNotEquals = (_manifest != null);
  if (_tripleNotEquals) {
    Set<String> _exportedPackages = this.getProjectConfig().getRuntime().getManifest().getExportedPackages();
    String _serializerBasePackage = this.getSerializerBasePackage(this.getGrammar());
    _exportedPackages.add(_serializerBasePackage);
    Set<String> _requiredBundles = this.getProjectConfig().getRuntime().getManifest().getRequiredBundles();
    String _xbaseLibVersionLowerBound = this.getProjectConfig().getRuntime().getXbaseLibVersionLowerBound();
    String _plus = ("org.eclipse.xtext.xbase.lib;bundle-version=\"" + _xbaseLibVersionLowerBound);
    String _plus_1 = (_plus + "\"");
    _requiredBundles.add(_plus_1);
  }
  this.generateAbstractSemanticSequencer();
  this.generateAbstractSyntacticSequencer();
  boolean _isGenerateStub = this.isGenerateStub();
  if (_isGenerateStub) {
    this.generateSemanticSequencer();
    this.generateSyntacticSequencer();
  }
  if (this.generateDebugData) {
    this.generateGrammarConstraints();
    Iterable<Pair<String, String>> _generateDebugGraphs = this.debugGraphGenerator.generateDebugGraphs();
    for (final Pair<String, String> fileToContent : _generateDebugGraphs) {
      this.getProjectConfig().getRuntime().getSrcGen().generateFile(fileToContent.getKey(), fileToContent.getValue());
    }
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:31,代码来源:SerializerFragment2.java

示例4: bindISerializer

import org.eclipse.xtext.serializer.impl.Serializer; //导入依赖的package包/类
public Class<? extends ISerializer> bindISerializer() {
	return Serializer.class;
}
 
开发者ID:rehne93,项目名称:pokemon-tcgo-deck-generator,代码行数:4,代码来源:AbstractPkmntcgoRuntimeModule.java


注:本文中的org.eclipse.xtext.serializer.impl.Serializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。