Module org.eclipse.xtend.lib
Annotation Interface ToString
Creates a default
toString implementation.
All non-static fields of this class and all of its superclasses are used.
Reflection is used to access all fields if this class has a superclass. This may not work in restrictive environments.
For such cases use ToStringBuilder to write a non-reflective implementation.
ClassName [
field1 = "Foo"
field2 = 2
field3 = null
]
The class name is hardcoded. Subclasses which inherit this class without overriding toString will show the same name.
For brevity there are options to hide field names, skip fields with null values and print everything on one line.
- Since:
- 2.7
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanOnly list the values of the fields, not their namesbooleanSeperate fields with a comma and a single spacebooleanFields with null values are not shown in the output.booleanBy default, Iterables, Arrays and multiline Strings are pretty-printed.
-
Element Details
-
skipNulls
boolean skipNullsFields with null values are not shown in the output.- Default:
false
-
singleLine
boolean singleLineSeperate fields with a comma and a single space- Default:
false
-
hideFieldNames
boolean hideFieldNamesOnly list the values of the fields, not their names- Default:
false
-
verbatimValues
boolean verbatimValuesBy default, Iterables, Arrays and multiline Strings are pretty-printed. Switching to their normal representation makes the toString method significantly faster.- Since:
- 2.9
- Default:
false
-