Class CardWeaver
java.lang.Object
com.robinloom.jweaver.card.CardWeaver
- All Implemented Interfaces:
Weaver
CardWeaver depicts a given object as a framed card
with aligned key-value pairs inside a box.
This representation focuses on clarity and aesthetics,
making it well-suited for logs, debug output, or summaries.
Example:
╭ User ───────────────╮ │ name : Alice │ │ age : 28 │ │ email : alice@a.com │ ╰─────────────────────╯
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSets the set of characters to use for the box bordering the contentEnables capitalization of field names. firstName -> FirstNameexcludeFields(List<String> fields) Sets the names of fields that should be excluded from the output.includeFields(List<String> fields) Sets the names of fields that should be included in the output.Determines if the class name should be omitted when printing.Enables the printing of data typesActivates the inclusion of inherited fields.Generates a string representation of the given object via reflections.
-
Field Details
-
history
-
-
Constructor Details
-
CardWeaver
public CardWeaver()
-
-
Method Details
-
includeFields
Sets the names of fields that should be included in the output. By default, every field is included.- Parameters:
fields- list of strings containing included field names- Returns:
- instance for chaining
-
excludeFields
Sets the names of fields that should be excluded from the output. By default, no field is excluded.- Parameters:
fields- list of strings containing excluded field names- Returns:
- instance for chaining
-
omitClassName
Determines if the class name should be omitted when printing. By default, the class name is included.- Returns:
- instance for chaining
-
capitalizeFields
Enables capitalization of field names. firstName -> FirstName- Returns:
- instance for chaining
-
showDataTypes
-
showInheritedFields
Activates the inclusion of inherited fields.- Returns:
- instance for chaining
-
boxChars
Sets the set of characters to use for the box bordering the content- Parameters:
boxChars- the charset to use for the card box- Returns:
- instance for chaining
-
weave
Generates a string representation of the given object via reflections. Prints the class name followed by every accessible field in an ordered structure resembling a business card. For JDK classes, a regulartoString()result is returned. Detects reciprocal and circular object dependencies.
-