public final class As extends Object
Example:
As.string(this).indent().add("abc", abc).toString();
Modifier and Type | Method and Description |
---|---|
As |
add(String name,
Iterable<?> iterable)
Adds a member to this toString representation.
|
As |
add(String name,
Object value)
Adds a member to this toString representation.
|
As |
addIf(boolean condition,
String name,
Object value)
Same as
add(String, Object) , except it will only add the member if the given condition is true. |
As |
addUnlessEmpty(String name,
Iterable<?> iterable)
Same as
add(String, Iterable) , except it will only add the member if the iterable is not empty. |
As |
fields()
Specifies that all fields should be added.
|
As |
indent()
Specifies that this toString representation should indent and write each member on a separate line.
|
As |
named(String name)
Creates a new string representation helper described by the given name.
|
static String |
simpleString(Syntax syntax,
boolean includeUnitType)
Creates a simple toString representation of the given
Syntax unit, based on how it would be output in CSS. |
static As |
string(Object object)
Creates a new string representation helper for the given object.
|
String |
toString() |
public static As string(Object object)
object
- Create a string representation of this object.public static String simpleString(Syntax syntax, boolean includeUnitType)
Syntax
unit, based on how it would be output in CSS.syntax
- The unit.includeUnitType
- Specify true to append in parenthesis the syntax type (e.g., 'pseudo-element-selector').public As named(String name)
name
- Name of the object being represented.public As indent()
public As add(String name, Object value)
name
- Name of the member.value
- The member.public As addIf(boolean condition, String name, Object value)
add(String, Object)
, except it will only add the member if the given condition is true.condition
- Only add if this condition is true.name
- Name of the member.value
- The member.public As add(String name, Iterable<?> iterable)
name
- Name of the member.iterable
- The member.public As addUnlessEmpty(String name, Iterable<?> iterable)
add(String, Iterable)
, except it will only add the member if the iterable is not empty.name
- Name of the member.iterable
- The member.public As fields()
Fields with a value of null will not be output. Iterables will be added with add(String, Iterable)
and indent()
will automatically be turned on upon the first addition of an iterable. If the object being printed is a Syntax
unit, line, column, and comments information will automatically be added.
Copyright (c) 2019, Salesforce.com, Inc. All rights reserved. Licensed under the BSD 3-Clause license. For full license text, see the LICENSE file in the repository.