[
https://issues.apache.org/jira/browse/LANG-1366?focusedWorklogId=323311&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-323311
]
ASF GitHub Bot logged work on LANG-1366:
----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Oct/19 10:16
Start Date: 04/Oct/19 10:16
Worklog Time Spent: 10m
Work Description: kinow commented on pull request #308: LANG-1366 : Add
Feature for No ClassName and MultiLine StringStyle
URL: https://github.com/apache/commons-lang/pull/308#discussion_r331431799
##########
File path: src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
##########
@@ -2633,4 +2647,48 @@ private Object readResolve() {
}
}
+
+ //
----------------------------------------------------------------------------
+
+ /**
+ * <p>
+ * <code>ToStringStyle</code> that outputs with No Class Name in a Multi
Line format.
+ * </p>
+ *
+ * <p>
+ * This is an inner class rather than using
+ * <code>StandardToStringStyle</code> to ensure its immutability.
+ * </p>
+ *
+ * @since 3.7
+ * @see <a href="http://json.org">json.org</a>
+ */
+ private static final class NoClassNameMultiLineToStringStyle extends
ToStringStyle {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * <p>Constructor.</p>
+ * <p>
+ * <p>Use the static constant rather than instantiating.</p>
+ */
+ NoClassNameMultiLineToStringStyle() {
+ super();
+ this.setUseClassName(false);
+ this.setUseIdentityHashCode(false);
+ this.setContentStart(StringUtils.EMPTY);
+ this.setFieldSeparator(System.lineSeparator());
+ this.setFieldSeparatorAtStart(false);
+ this.setContentEnd(System.lineSeparator());
+ }
+
+ /**
+ * <p>Ensure <code>Singleton</code> after serialization.</p>
+ *
+ * @return the singleton
+ */
+ private Object readResolve() {
+ return ToStringStyle.NO_CLASS_NAME_MULTI_LINE_STYLE;
Review comment:
Really nit-picking here, but other classes in this file are referencing it
without the class name (as this is the same class...). So if possible, for
consistency it could be the same, i.e. `return
NO_CLASS_NAME_MULTI_LINE_STYLE;`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 323311)
Time Spent: 20m (was: 10m)
> Add Feature for No ClassName and MultiLine StringStyle
> ------------------------------------------------------
>
> Key: LANG-1366
> URL: https://issues.apache.org/jira/browse/LANG-1366
> Project: Commons Lang
> Issue Type: Improvement
> Components: lang.*
> Reporter: Karthikeyan Palanivelu
> Priority: Major
> Labels: features
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Add feature to print String with No Class Name and MultiLine. This would be
> of helpful for more like metrics related use cases which needs to print like
> properties with No Class Name and each property in new line.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)