Class JWeaver

java.lang.Object
com.robinloom.jweaver.JWeaver

public final class JWeaver extends Object
The main entry point for object weaving in JWeaver.

Minimal usage: Most users can simply call weave(Object) to get a human-readable, structured string representation of any object without having to write a toString() method or make any configuration decisions:

String result = JWeaver.weave(myObject);
System.out.println(result);

The default weaving strategy automatically handles:

  • Small objects: compact one-line output
  • Large or nested objects: structured tree output
  • Collections: limited to a safe number of elements
  • Circular or reciprocal references
  • Sensitive fields such as passwords or tokens (automatically ignored)

Advanced usage: For power users who want specific renderers or a custom context, the JWeaver.Internal class provides access to different weavers and full control:

String treeResult = JWeaver.Internal.tree().weave(myObject);
String bulletResult = JWeaver.Internal.bullet().weave(myObject);

This design keeps the API minimal and safe for most users while allowing extensibility and experimentation for advanced scenarios.

  • Method Details

    • weave

      public static String weave(Object object)
      Generates a string representation of the given object via reflections. Prints the class name followed by every accessible field. For JDK classes, a regular toString() 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