[ 
https://issues.apache.org/jira/browse/LANG-1625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Caleb Cushing updated LANG-1625:
--------------------------------
    Description: 
what I want is to be able to add multiline/prettyprint to any style. I like the 
`IsStringBuilder.reflectionToString` method, but I wish it could support 
compound styling, for example 

```java

var styles = new StyleBuilder().multiline().json();
IsStringBuilder.reflectionToString(obj, styles);
```
or
```java
var styles = new StyleBuilder().multiline().shortPrefix();
IsStringBuilder.reflectionToString(obj, styles);
```
I feel like adding an additional parameter breaks the rule of no more than 4 
parameters unless varargs (josh bloch, and others), so I'm proposing a builder.

```java

var styles = new StyleBuilder()
    .multiline()
    .shortPrefix()
    .outputTransients()
    .reflectUpToSuperClass(...); // name change here, I didn't quite get what 
it was talking about at first in the documentation.

```

or maybe

```java
ToStringFormatter formatter= ToStringFormat.of( ToStringStyle.SHORT_PREFIX, 
ToStringLineStyle.MULTILINE);

ToStringBuilder.reflectUpToSuperClass(this, formatter, true, MyClass.class);

```

  was:I like the `IsStringBuilder.reflectionToString` method, but I wish it 
could support compound styling, for example 


> IsStringBuilder.reflectionToString compound styles
> --------------------------------------------------
>
>                 Key: LANG-1625
>                 URL: https://issues.apache.org/jira/browse/LANG-1625
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.builder.*
>            Reporter: Caleb Cushing
>            Priority: Major
>
> what I want is to be able to add multiline/prettyprint to any style. I like 
> the `IsStringBuilder.reflectionToString` method, but I wish it could support 
> compound styling, for example 
> ```java
> var styles = new StyleBuilder().multiline().json();
> IsStringBuilder.reflectionToString(obj, styles);
> ```
> or
> ```java
> var styles = new StyleBuilder().multiline().shortPrefix();
> IsStringBuilder.reflectionToString(obj, styles);
> ```
> I feel like adding an additional parameter breaks the rule of no more than 4 
> parameters unless varargs (josh bloch, and others), so I'm proposing a 
> builder.
> ```java
> var styles = new StyleBuilder()
>     .multiline()
>     .shortPrefix()
>     .outputTransients()
>     .reflectUpToSuperClass(...); // name change here, I didn't quite get what 
> it was talking about at first in the documentation.
> ```
> or maybe
> ```java
> ToStringFormatter formatter= ToStringFormat.of( ToStringStyle.SHORT_PREFIX, 
> ToStringLineStyle.MULTILINE);
> ToStringBuilder.reflectUpToSuperClass(this, formatter, true, MyClass.class);
> ```



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to