[ 
https://issues.apache.org/jira/browse/LANG-1466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17371267#comment-17371267
 ] 

Liran Mendelovich commented on LANG-1466:
-----------------------------------------

Out of the box implementation exists:

_ReflectionToStringBuilder.toString(new Pojo(), ToStringStyle.DEFAULT_STYLE, 
true, false, *true*, null)_

Output is as requested:

{{general.Pojo@3532ec19[description=Manchester,id=1]}}

Using:
_public static String toString( final T object, final ToStringStyle style, 
final boolean outputTransients, final boolean outputStatics, final boolean 
*excludeNullValues*, final Class<? super T> reflectUpToClass)_

 

> new property "omitNullValues" ToStringBuilder
> ---------------------------------------------
>
>                 Key: LANG-1466
>                 URL: https://issues.apache.org/jira/browse/LANG-1466
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.builder.*
>    Affects Versions: 3.9
>            Reporter: nimo mayr
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Actually, commons lang "{{ReflectionToStringBuilder"}} *cannot exclude null 
> values*{{:}}
>   
> {code:java}
> return ToStringBuilder.reflectionToString(object, 
> ToStringStyle.MULTI_LINE_STYLE);{code}
> Please provide a new property "omitNullValues" to exclude null values from 
> the "object"-string.
>  
> {code:java}
> boolean omitNullValues = true;
> return ToStringBuilder.reflectionToString(object, 
> ToStringStyle.MULTI_LINE_STYLE, omitNullValues);
> {code}
>  



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

Reply via email to