Java Code Examples for org.eclipse.xtext.xbase.lib.util.ToStringBuilder

The following examples show how to use org.eclipse.xtext.xbase.lib.util.ToStringBuilder. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: xtext-extras   Source File: JvmTypesBuilder.java    License: Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Creates a <code>toString()</code> method accumulating the values of all fields.
 *
 * @return a result representing a Java toString() method, <code>null</code> if sourceElement or declaredType are <code>null</code>.
 */
/* @Nullable */ 
public JvmOperation toToStringMethod(/* @Nullable */ final EObject sourceElement, /* @Nullable */ final JvmDeclaredType declaredType) {
	if(sourceElement == null || declaredType == null)
		return null;
	JvmOperation result = toMethod(sourceElement, "toString", newTypeRef(sourceElement, String.class), null);
	if (result == null)
		return null;
	JvmType overrideType = references.findDeclaredType(Override.class, sourceElement);
	if (overrideType != null)
		result.getAnnotations().add(toAnnotation(sourceElement, Override.class));
	setBody(result, new Procedure1<ITreeAppendable>() {
		@Override
		public void apply(/* @Nullable */ ITreeAppendable p) {
			if (p == null)
				return;
			p.append("String result = new ");
			p.append(ToStringBuilder.class);
			p.append("(this).addAllFields().toString();");
			p.newLine().append("return result;");
		}
	});
	return result;
}
 
Example 2
Source Project: lsp4j   Source File: CompletionItem.java    License: Eclipse Public License 2.0 6 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("label", this.label);
  b.add("kind", this.kind);
  b.add("tags", this.tags);
  b.add("detail", this.detail);
  b.add("documentation", this.documentation);
  b.add("deprecated", this.deprecated);
  b.add("preselect", this.preselect);
  b.add("sortText", this.sortText);
  b.add("filterText", this.filterText);
  b.add("insertText", this.insertText);
  b.add("insertTextFormat", this.insertTextFormat);
  b.add("textEdit", this.textEdit);
  b.add("additionalTextEdits", this.additionalTextEdits);
  b.add("commitCharacters", this.commitCharacters);
  b.add("command", this.command);
  b.add("data", this.data);
  return b.toString();
}
 
Example 3
Source Project: lsp4j   Source File: SignatureInformation.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("label", this.label);
  b.add("documentation", this.documentation);
  b.add("parameters", this.parameters);
  return b.toString();
}
 
Example 4
Source Project: lsp4j   Source File: ParameterInformation.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("label", this.label);
  b.add("documentation", this.documentation);
  return b.toString();
}
 
Example 5
Source Project: lsp4j   Source File: SignatureHelpOptions.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("triggerCharacters", this.triggerCharacters);
  b.add("retriggerCharacters", this.retriggerCharacters);
  return b.toString();
}
 
Example 6
Source Project: lsp4j   Source File: DisassembledInstruction.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("address", this.address);
  b.add("instructionBytes", this.instructionBytes);
  b.add("instruction", this.instruction);
  b.add("symbol", this.symbol);
  b.add("location", this.location);
  b.add("line", this.line);
  b.add("column", this.column);
  b.add("endLine", this.endLine);
  b.add("endColumn", this.endColumn);
  return b.toString();
}
 
Example 7
Source Project: sarl   Source File: Address.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
	final ToStringBuilder builder = new ToStringBuilder(this);
	builder.add("type", getClass().getSimpleName()); //$NON-NLS-1$
	builder.add("participantId", this.participantId); //$NON-NLS-1$
	builder.add("spaceId", this.spaceId); //$NON-NLS-1$
	return builder.toString();
}
 
Example 8
Source Project: xtext-xtend   Source File: Case_0.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("id", this.id);
  return b.toString();
}
 
Example 9
Source Project: build-server-protocol   Source File: ResourcesResult.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("items", this.items);
  return b.toString();
}
 
Example 10
Source Project: xtext-extras   Source File: EvaluationResult.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("rawValue", this.rawValue);
  b.add("compileTimeConstant", this.compileTimeConstant);
  return b.toString();
}
 
Example 11
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("location", this.location);
  b.add("message", this.message);
  return b.toString();
}
 
Example 12
Source Project: xtext-lib   Source File: ToStringBuilderTest.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testSkipNulls() {
  ToStringBuilderTest.MyEntity _myEntity = new ToStringBuilderTest.MyEntity();
  final ToStringBuilder builder = new ToStringBuilder(_myEntity).skipNulls().addAllFields();
  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("policy = CLASS");
  _builder.newLine();
  _builder.append("]");
  Assert.assertEquals(
    ToStringBuilderTest.toUnix(_builder.toString()), builder.toString());
}
 
Example 13
Source Project: xtext-core   Source File: ContentAssistEntry.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String toString() {
	ToStringBuilder b = new ToStringBuilder(this);
	b.skipNulls();
	b.add("prefix", this.prefix);
	b.add("proposal", this.proposal);
	b.add("label", this.label);
	b.add("description", this.description);
	b.add("documentation", this.documentation);
	b.add("escapePosition", this.escapePosition);
	b.add("textReplacements", this.textReplacements);
	b.add("editPositions", this.editPositions);
	b.add("kind", this.kind);
	return b.toString();
}
 
Example 14
Source Project: lsp4j   Source File: BreakpointLocation.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("line", this.line);
  b.add("column", this.column);
  b.add("endLine", this.endLine);
  b.add("endColumn", this.endColumn);
  return b.toString();
}
 
Example 15
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("range", this.range);
  b.add("rangeLength", this.rangeLength);
  b.add("text", this.text);
  return b.toString();
}
 
Example 16
Source Project: lsp4j   Source File: TextDocumentItem.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("uri", this.uri);
  b.add("languageId", this.languageId);
  b.add("version", this.version);
  b.add("text", this.text);
  return b.toString();
}
 
Example 17
Source Project: sarl   Source File: SpaceID.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
	final ToStringBuilder builder = new ToStringBuilder(this);
	builder.add("type", getClass().getSimpleName()); //$NON-NLS-1$
	builder.add("id", this.id); //$NON-NLS-1$
	builder.add("contextID", this.contextID); //$NON-NLS-1$
	builder.add("spaceSpec", this.spaceSpec); //$NON-NLS-1$
	return builder.toString();
}
 
Example 18
Source Project: xtext-extras   Source File: TypeReferenceBucket.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
public String toString() {
	ToStringBuilder b = new ToStringBuilder(this);
	b.add("id", id);
	b.add("types", types);
	return b.toString();
}
 
Example 19
Source Project: lsp4j   Source File: ModuleEventArguments.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("reason", this.reason);
  b.add("module", this.module);
  return b.toString();
}
 
Example 20
Source Project: lsp4j   Source File: ProcessEventArguments.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("name", this.name);
  b.add("systemProcessId", this.systemProcessId);
  b.add("isLocalProcess", this.isLocalProcess);
  b.add("startMethod", this.startMethod);
  b.add("pointerSize", this.pointerSize);
  return b.toString();
}
 
Example 21
Source Project: lsp4j   Source File: RenameOptions.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("prepareProvider", this.prepareProvider);
  b.add("id", getId());
  b.add("documentSelector", getDocumentSelector());
  return b.toString();
}
 
Example 22
Source Project: lsp4j   Source File: GotoTargetsArguments.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("source", this.source);
  b.add("line", this.line);
  b.add("column", this.column);
  return b.toString();
}
 
Example 23
Source Project: lsp4j   Source File: WorkspaceClientCapabilities.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("applyEdit", this.applyEdit);
  b.add("workspaceEdit", this.workspaceEdit);
  b.add("didChangeConfiguration", this.didChangeConfiguration);
  b.add("didChangeWatchedFiles", this.didChangeWatchedFiles);
  b.add("symbol", this.symbol);
  b.add("executeCommand", this.executeCommand);
  b.add("workspaceFolders", this.workspaceFolders);
  b.add("configuration", this.configuration);
  return b.toString();
}
 
Example 24
Source Project: xtext-xtend   Source File: ASTParserFactory.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("targetLevel", this.targetLevel);
  b.add("parser", this.parser);
  return b.toString();
}
 
Example 25
Source Project: xtext-xtend   Source File: Html.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  return new ToStringBuilder(this)
  	.addAllFields()
  	.toString();
}
 
Example 26
Source Project: lsp4j   Source File: PrepareRenameResult.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("range", this.range);
  b.add("placeholder", this.placeholder);
  return b.toString();
}
 
Example 27
Source Project: xtext-eclipse   Source File: LoggingTester.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("message", this.message);
  b.add("source", this.source);
  b.add("timeStamp", this.timeStamp);
  b.add("level", this.level);
  return b.toString();
}
 
Example 28
Source Project: build-server-protocol   Source File: TaskId.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("id", this.id);
  b.add("parents", this.parents);
  return b.toString();
}
 
Example 29
Source Project: lsp4j   Source File: MarkupContent.java    License: Eclipse Public License 2.0 5 votes vote down vote up
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("kind", this.kind);
  b.add("value", this.value);
  return b.toString();
}
 
Example 30
@Override
@Pure
public String toString() {
  ToStringBuilder b = new ToStringBuilder(this);
  b.add("targets", this.targets);
  b.add("originId", this.originId);
  return b.toString();
}