commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Tan (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LANG-1117) Want an implemention of ToStringBuilder supports annotation
Date Sat, 18 Apr 2015 14:01:58 GMT
Jack Tan created LANG-1117:
------------------------------

             Summary: Want an implemention of ToStringBuilder supports annotation
                 Key: LANG-1117
                 URL: https://issues.apache.org/jira/browse/LANG-1117
             Project: Commons Lang
          Issue Type: Wish
          Components: lang.builder.*
    Affects Versions: 3.4
            Reporter: Jack Tan


When using {{ReflectionToStringBuilder}}, we need call {{ReflectionToStringBuilder.setExcludeFieldNames(str1,str2)}}
to exclude fields. Why not use annotation? Just look like:
{code:title=Bar.java|borderStyle=solid}
public class Bar {
    private String name;
    private Date signDate;
    private int age;

    @ExcludeFields({"signDate", "age"})
    public String toString() {
        return AnnotationToStringBuilder.toString(this, ToStringStyle.JSON_STYLE);
    }
}

{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message