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


Java ToStringHelper类代码示例

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


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

示例1: recursionHandling

import org.eclipse.xtext.xbase.lib.util.ToStringHelper; //导入依赖的package包/类
@Test
public void recursionHandling() {
  final ToStringHelper helper = new ToStringHelper();
  final ToStringHelperTest.OtherClass obj = new ToStringHelperTest.OtherClass();
  obj.name = "foo";
  obj.other = obj;
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("OtherClass [");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("other = ");
  String _string = obj.toString();
  _builder.append(_string, "  ");
  _builder.newLineIfNotEmpty();
  _builder.append("  ");
  _builder.append("name = \"foo\"");
  _builder.newLine();
  _builder.append("]");
  Assert.assertEquals(
    ToStringHelperTest.toUnix(_builder.toString()), helper.toString(obj));
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:22,代码来源:ToStringHelperTest.java

示例2: recursionHandling_02

import org.eclipse.xtext.xbase.lib.util.ToStringHelper; //导入依赖的package包/类
@Test
public void recursionHandling_02() {
  final ToStringHelper helper = new ToStringHelper();
  final ToStringHelperTest.DataClass obj = new ToStringHelperTest.DataClass();
  obj.other = obj;
  obj.name = "test";
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("DataClass [");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("other = [email protected]");
  int _identityHashCode = System.identityHashCode(obj);
  _builder.append(_identityHashCode, "  ");
  _builder.newLineIfNotEmpty();
  _builder.append("  ");
  _builder.append("name = \"test\"");
  _builder.newLine();
  _builder.append("]");
  Assert.assertEquals(
    ToStringHelperTest.toUnix(_builder.toString()), helper.toString(obj));
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:22,代码来源:ToStringHelperTest.java

示例3: addDataToString

import org.eclipse.xtext.xbase.lib.util.ToStringHelper; //导入依赖的package包/类
public void addDataToString(final MutableClassDeclaration cls) {
  final Procedure1<MutableMethodDeclaration> _function = new Procedure1<MutableMethodDeclaration>() {
    @Override
    public void apply(final MutableMethodDeclaration it) {
      Util.this.context.setPrimarySourceElement(it, Util.this.context.getPrimarySourceElement(cls));
      it.setReturnType(Util.this.context.getString());
      it.addAnnotation(Util.this.context.newAnnotationReference(Override.class));
      it.addAnnotation(Util.this.context.newAnnotationReference(Pure.class));
      StringConcatenationClient _client = new StringConcatenationClient() {
        @Override
        protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) {
          _builder.append("String result = new ");
          _builder.append(ToStringHelper.class);
          _builder.append("().toString(this);");
          _builder.newLineIfNotEmpty();
          _builder.append("return result;");
          _builder.newLine();
        }
      };
      it.setBody(_client);
    }
  };
  cls.addMethod("toString", _function);
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:25,代码来源:DataProcessor.java

示例4: testToString

import org.eclipse.xtext.xbase.lib.util.ToStringHelper; //导入依赖的package包/类
@Test
public void testToString() {
  final ToStringHelper helper = new ToStringHelper();
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("MyEntity [");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("boolProp = true");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("intProp = 42");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("myList = ArrayList (");
  _builder.newLine();
  _builder.append("    ");
  _builder.append("\"foo\",");
  _builder.newLine();
  _builder.append("    ");
  _builder.append("\"bar\",");
  _builder.newLine();
  _builder.append("    ");
  _builder.append("\"baz\"");
  _builder.newLine();
  _builder.append("  ");
  _builder.append(")");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("friend = true");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("42");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("[foo, bar, baz]");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("null");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("CLASS");
  _builder.newLine();
  _builder.append("  ");
  _builder.append("policy = CLASS");
  _builder.newLine();
  _builder.append("]");
  ToStringHelperTest.MyEntity _myEntity = new ToStringHelperTest.MyEntity();
  ToStringHelperTest.MyEntity _myEntity_1 = new ToStringHelperTest.MyEntity(_myEntity);
  Assert.assertEquals(
    ToStringHelperTest.toUnix(_builder.toString()), helper.toString(_myEntity_1));
}
 
开发者ID:eclipse,项目名称:xtext-lib,代码行数:52,代码来源:ToStringHelperTest.java

示例5: toString

import org.eclipse.xtext.xbase.lib.util.ToStringHelper; //导入依赖的package包/类
@Override
@Pure
public String toString() {
  String result = new ToStringHelper().toString(this);
  return result;
}
 
开发者ID:East196,项目名称:maker,代码行数:7,代码来源:Page.java

示例6: toString

import org.eclipse.xtext.xbase.lib.util.ToStringHelper; //导入依赖的package包/类
@Override
public String toString() {
  String result = new ToStringHelper().toString(this);
  return result;
}
 
开发者ID:oehme,项目名称:xtext-maven-example,代码行数:6,代码来源:LaunchConfigurationInfo.java


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