freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dekany (JIRA)" <>
Subject [jira] [Updated] (FREEMARKER-39) DefaultObjectWrapperBuilder isn't a Builder
Date Sun, 06 Nov 2016 09:52:58 GMT


Daniel Dekany updated FREEMARKER-39:
    Affects Version/s:     (was: 2.3.23)

> DefaultObjectWrapperBuilder isn't a Builder
> -------------------------------------------
>                 Key: FREEMARKER-39
>                 URL:
>             Project: Apache Freemarker
>          Issue Type: Improvement
>          Components: engine
>    Affects Versions: 2.3.25-incubating
>            Reporter: Brian Pontarelli
> This might not be considered a bug, but I'm logging it as one rather than an improvement.
The class {{DefaultObjectWrapperBuilder}} is not actually a builder right now and it makes
using it inline impossible. 
> To make it a more standard Builder pattern, all of the setter methods should be updated
so that the return type is {{DefaultObjectWrapperBuilder}} and the method does a {{return
this;}} at the end. This will make method chaining possible and inline use also possible.
Since it uses inheritance extensively (you might want to consider unwinding this as well),
you'll need to use generics and return T. Here's the class definition so that T works:
> {}
> public class DefaultObjectWrapperBuilder extends DefaultObjectWrapperConfiguration<DefaultObjectWrapperBuilder>
> {code}
> And the parent class is defined like this:
> {}
> public abstract class DefaultObjectWrapperConfiguration<T> extends BeansWrapperConfiguration<T>
> {code}
> That the final parent class is defined like this:
> {}
> public abstract class BeansWrapperConfiguration<T extends BeansWrapperConfiguration>
implements Cloneable
> {code}

This message was sent by Atlassian JIRA

View raw message