Package com.robinloom.jweaver.bullet
Class BulletWeaver
java.lang.Object
com.robinloom.jweaver.bullet.BulletWeaver
BulletWeaver generates a string representation for a given object by arranging
the object information (class name, field names, values) in a list with indented items.
Example:
Person - name=John Doe - birthday=1990-01-01
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEnables capitalization of field names.deeperLevelBulletChar(char character) Sets the character to be used for a bullet on third level or deeper.excludeFields(List<String> fields) Sets the names of fields that should be excluded from the output.firstLevelBulletChar(char character) Sets the character to be used for a bullet on first level.includeFields(List<String> fields) Sets the names of fields that should be included in the output.indentation(int indentation) Sets the amount of indentation to be applied for every step.maxDepth(int maxDepth) Sets the maximum depth for the resulting tree.maxSequenceLength(int maxSequenceLength) Sets the maximum length of collections and arrays to be included in the output.secondLevelBulletChar(char character) Sets the character to be used for a bullet on second level.Enables the printing of data typesActivates the inclusion of inherited fields.Generates a string representation of the given object via reflections.
-
Constructor Details
-
BulletWeaver
public BulletWeaver()
-
-
Method Details
-
firstLevelBulletChar
Sets the character to be used for a bullet on first level.- Parameters:
character- character to be used- Returns:
- instance for chaining
-
secondLevelBulletChar
Sets the character to be used for a bullet on second level.- Parameters:
character- character to be used- Returns:
- instance for chaining
-
deeperLevelBulletChar
Sets the character to be used for a bullet on third level or deeper.- Parameters:
character- character to be used- Returns:
- instance for chaining
-
indentation
Sets the amount of indentation to be applied for every step. Default is 2.- Parameters:
indentation- integer for the indentation level- Returns:
- instance for chaining
-
maxDepth
Sets the maximum depth for the resulting tree.- Parameters:
maxDepth- an integer for the maximum depth- Returns:
- instance for chaining
-
maxSequenceLength
Sets the maximum length of collections and arrays to be included in the output. Elements that exceed the limit will be summarized (... 57 more).- Parameters:
maxSequenceLength- an integer value- Returns:
- instance for chaining
-
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
-
capitalizeFields
Enables capitalization of field names. firstName -> FirstName- Returns:
- instance for chaining
-
showDataTypes
Enables the printing of data types- Returns:
- instance for chaining
-
showInheritedFields
Activates the inclusion of inherited fields.- 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 a list structure. For JDK classes, a regulartoString()result is returned. Detects reciprocal and circular object dependencies.- Parameters:
object- object to generate a string representation for- Returns:
- a well-structured, human-readable representation of that object
-