public static interface ToString.Configurator
Pattern Builder with the
purpose to properly create a ToString.Configuration.| Modifier and Type | Method and Description |
|---|---|
String |
like(ToString.Printer printer)
Creates the
ToString.Configuration and invokes
the provided ToString.Printer in order to
build the requested String representation. |
String |
likeEclipse()
Creates an output of the method
Object.toString()
like the one generated by the Eclipse IDE. |
String |
likeFunction()
Creates an output of the method
Object.toString()
in the form of a function, where the function name is the
target class name and the given fields are listed as the
function arguments. |
String |
likeIntellij()
Creates an output of the method
Object.toString()
like the one generated by the IntelliJ IDE. |
String |
likeTuple()
Creates an output of the method
Object.toString()
in the form of a tuple, optionally preceded by the
class name. |
ToString.Configurator |
print(Object... values)
Adds the given list of values as unnamed
Fields in the
resulting ToString.Configuration. |
ToString.Configurator |
print(String name,
Object value)
|
String |
using(String prefix,
String fieldSeparator,
String suffix)
This is a convenience method.
|
String |
using(String prefix,
String nameValueSeparator,
String fieldSeparator,
String suffix)
Creates an output of the method
Object.toString()
using the given prefix and suffix and using the given
separators. |
ToString.Configurator |
withCustomClassName(String value)
Tells the
ToString class to print
the given text instead of the class name. |
ToString.Configurator |
withFullClassName()
Tells the
ToString class to print
the full qualified class name. |
ToString.Configurator |
withNoClassName()
Tells the
ToString class to do not print
the class name in any form. |
ToString.Configurator print(Object... values)
Fields in the
resulting ToString.Configuration.values - values to add to the configuration.ToString.Configurator.ToString.Configurator print(String name, Object value)
name - the name of the field.value - the value of the field.ToString.Configurator.ToString.Configurator withNoClassName()
ToString class to do not print
the class name in any form.ToString.Configurator.ToString.Configurator withFullClassName()
ToString class to print
the full qualified class name.ToString.Configurator.ToString.Configurator withCustomClassName(String value)
ToString class to print
the given text instead of the class name.
If you invoke this method with null
than "null" will be printed instead
of the class name.
value - value of the custom text to set.ToString.Configurator.String like(ToString.Printer printer)
ToString.Configuration and invokes
the provided ToString.Printer in order to
build the requested String representation.
This method provides the widest range of customizations. You can implement is own favorite style to display objects.
printer - the printer to invoke.String representation.String likeEclipse()
Object.toString()
like the one generated by the Eclipse IDE.Eclipse IDE.String likeIntellij()
Object.toString()
like the one generated by the IntelliJ IDE.IntelliJ IDE.String likeFunction()
Object.toString()
in the form of a function, where the function name is the
target class name and the given fields are listed as the
function arguments.
This method is intended to be used to implement the
Object.toString() method of functional classes.
For example if you are developing a class to apply some
operations dynamically, you may want the Object.toString()
of your class to be something like: Apply(MyOperation)
or Apply(op:MyOperation)
String likeTuple()
Object.toString()
in the form of a tuple, optionally preceded by the
class name.
This method is intended to be used to implement the
Object.toString() method of classes that represents
relations or ordered collections of objects.
For example if you develop a class that represents
a pair of objects, you may want the Object.toString()
of you class to be something like: <key,value>.
String using(String prefix, String nameValueSeparator, String fieldSeparator, String suffix)
Object.toString()
using the given prefix and suffix and using the given
separators.
The resulting string will have the following components:
null or empty.
This method provides a quite wide range of customizations.
If you need to customize your Object.toString() output even more
you can use the method like(ToString.Printer).
prefix - the prefix to use before printing values.nameValueSeparator - the text to use to separate name and value of a field.fieldSeparator - the text to use to separate fields.suffix - the suffix to use after printing values.String using(String prefix, String fieldSeparator, String suffix)
using(String, String, String, String) with an empty or null
name-value separator.prefix - the prefix to use before printing values.fieldSeparator - the text to use to separate fields.suffix - the suffix to use after printing values.Copyright © 2011–2020 Nerd4j. All rights reserved.