Bean-related tools

BeanCopy

BeanCopy class offers copying functionality. It copies properties from source to destination bean.

BeanTemplateParser

BeanTemplateParser is a variant of StringTemplateParser. It parses macros in the strings and replace them with bean values. The usage is quite simple:

    // prepare template
    String template = "Hello ${user.name}. Today is ${dayName}.";
    ...

    // prepare the context
    Foo foo = new Foo();
    foo.getUser().setName("John Doe");
    foo.setDayName("Saturday");
    ...

    // parse
    BeanTemplateParser beanTemplateParser = new BeanTemplateParser();
    ContextTemplateParser ctp = beanTemplateParser.of(foo);

    String result = ctp.parse(template);
    // result == "Hello John Doe. Today is Saturday."