Class StringFactory


  • public final class StringFactory
    extends Object
    Factory class for building functions for String representations of Entity instances.
    Given a Entity instance named entity containing the following mappings:
     attribute1 -> value1
     attribute2 -> value2
     attribute3 -> value3
     fkAttribute -> {Entity instance with a single mapping refAttribute -> refValue}
    
     StringFactory.Builder builder = StringFactory.builder();
    
     builder.text("attribute1=")
            .value(attribute1)
            .text(", attribute3='")
            .value(attribute3)
            .text("' foreign key value=")
            .foreignKeyValue(fkAttribute, refAttribute);
    
     System.out.println(builder.build().apply(entity));
     
    outputs the following String:

    attribute1=value1, attribute3='value3' foreign key value=refValue