Reverse recent addition of date formatting. Better solution required.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137486 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6a0ce20988
commit
a1e6b5d617
|
@ -55,9 +55,7 @@ package org.apache.commons.lang.builder;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.lang.ObjectUtils;
|
import org.apache.commons.lang.ObjectUtils;
|
||||||
|
@ -87,7 +85,7 @@ import org.apache.commons.lang.SystemUtils;
|
||||||
* @author Stephen Colebourne
|
* @author Stephen Colebourne
|
||||||
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
|
* @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @version $Id: ToStringStyle.java,v 1.18 2003/07/21 19:34:10 ggregory Exp $
|
* @version $Id: ToStringStyle.java,v 1.19 2003/07/21 23:03:53 scolebourne Exp $
|
||||||
*/
|
*/
|
||||||
public abstract class ToStringStyle implements Serializable {
|
public abstract class ToStringStyle implements Serializable {
|
||||||
|
|
||||||
|
@ -191,25 +189,6 @@ public abstract class ToStringStyle implements Serializable {
|
||||||
*/
|
*/
|
||||||
private String summaryObjectEndText = ">";
|
private String summaryObjectEndText = ">";
|
||||||
|
|
||||||
/**
|
|
||||||
* An optional <code>DateFormat</code>.
|
|
||||||
*/
|
|
||||||
private DateFormat dateFormat = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the <code>DateFormat</code>, which may be <code>null</code>.
|
|
||||||
*/
|
|
||||||
protected DateFormat getDateFormat() {
|
|
||||||
return this.dateFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the <code>DateFormat</code>, which may be <code>null</code>.
|
|
||||||
*/
|
|
||||||
protected void setDateFormat(DateFormat dateFormat) {
|
|
||||||
this.dateFormat = dateFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -435,13 +414,6 @@ public abstract class ToStringStyle implements Serializable {
|
||||||
appendSummary(buffer, fieldName, (Object[]) value);
|
appendSummary(buffer, fieldName, (Object[]) value);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (value instanceof Date) {
|
|
||||||
if (detail) {
|
|
||||||
appendDetail(buffer, fieldName, (Date) value);
|
|
||||||
} else {
|
|
||||||
appendSummary(buffer, fieldName, (Object) value);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (detail) {
|
if (detail) {
|
||||||
appendDetail(buffer, fieldName, (Object) value);
|
appendDetail(buffer, fieldName, (Object) value);
|
||||||
|
@ -464,19 +436,6 @@ public abstract class ToStringStyle implements Serializable {
|
||||||
buffer.append(value);
|
buffer.append(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Append to the <code>toString</code> a <code>Date</code>
|
|
||||||
* value, using the optional <code>DateFormat</code>.</p>
|
|
||||||
*
|
|
||||||
* @param buffer the <code>StringBuffer</code> to populate
|
|
||||||
* @param fieldName the field name, typically not used as already appended
|
|
||||||
* @param value the <code>Date</code> to add to the <code>toString</code>,
|
|
||||||
* not <code>null</code>
|
|
||||||
*/
|
|
||||||
protected void appendDetail(StringBuffer buffer, String fieldName, Date value) {
|
|
||||||
buffer.append(this.getDateFormat() != null ? this.getDateFormat().format(value) : (Object) value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Append to the <code>toString</code> a <code>Collection</code>.</p>
|
* <p>Append to the <code>toString</code> a <code>Collection</code>.</p>
|
||||||
*
|
*
|
||||||
|
@ -2112,71 +2071,71 @@ public abstract class ToStringStyle implements Serializable {
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Removed, as the XML style needs more work for escaping characters, arrays,
|
// Removed, as the XML style needs more work for escaping characters, arrays,
|
||||||
// collections, maps and embedded beans.
|
// collections, maps and embedded beans.
|
||||||
// /**
|
// /**
|
||||||
// * ToStringStyle that outputs in XML style
|
// * ToStringStyle that outputs in XML style
|
||||||
// */
|
// */
|
||||||
// private static class XMLToStringStyle extends ToStringStyle {
|
// private static class XMLToStringStyle extends ToStringStyle {
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * Constructor - use the static constant rather than instantiating.
|
// * Constructor - use the static constant rather than instantiating.
|
||||||
// */
|
// */
|
||||||
// private XMLToStringStyle() {
|
// private XMLToStringStyle() {
|
||||||
// super();
|
// super();
|
||||||
// nullText = "null";
|
// nullText = "null";
|
||||||
// sizeStartText = "size=";
|
// sizeStartText = "size=";
|
||||||
// sizeEndText = "";
|
// sizeEndText = "";
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * @see ToStringStyle#appendStart(StringBuffer, Object)
|
// * @see ToStringStyle#appendStart(StringBuffer, Object)
|
||||||
// */
|
// */
|
||||||
// public void appendStart(StringBuffer buffer, Object object) {
|
// public void appendStart(StringBuffer buffer, Object object) {
|
||||||
// buffer.append('<');
|
// buffer.append('<');
|
||||||
// buffer.append(getShortClassName(object.getClass()));
|
// buffer.append(getShortClassName(object.getClass()));
|
||||||
// buffer.append(" class=\"");
|
// buffer.append(" class=\"");
|
||||||
// appendClassName(buffer, object);
|
// appendClassName(buffer, object);
|
||||||
// buffer.append("\" hashCode=\"");
|
// buffer.append("\" hashCode=\"");
|
||||||
// appendIdentityHashCode(buffer, object);
|
// appendIdentityHashCode(buffer, object);
|
||||||
// buffer.append("\">");
|
// buffer.append("\">");
|
||||||
// buffer.append(SystemUtils.LINE_SEPARATOR);
|
// buffer.append(SystemUtils.LINE_SEPARATOR);
|
||||||
// buffer.append(" ");
|
// buffer.append(" ");
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * @see ToStringStyle#appendFieldStart(StringBuffer, String)
|
// * @see ToStringStyle#appendFieldStart(StringBuffer, String)
|
||||||
// */
|
// */
|
||||||
// protected void appendFieldStart(StringBuffer buffer, String fieldName) {
|
// protected void appendFieldStart(StringBuffer buffer, String fieldName) {
|
||||||
// buffer.append('<');
|
// buffer.append('<');
|
||||||
// buffer.append(fieldName);
|
// buffer.append(fieldName);
|
||||||
// buffer.append('>');
|
// buffer.append('>');
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * @see ToStringStyle#appendFieldEnd(StringBuffer, String)
|
// * @see ToStringStyle#appendFieldEnd(StringBuffer, String)
|
||||||
// */
|
// */
|
||||||
// protected void appendFieldEnd(StringBuffer buffer, String fieldName) {
|
// protected void appendFieldEnd(StringBuffer buffer, String fieldName) {
|
||||||
// buffer.append("</");
|
// buffer.append("</");
|
||||||
// buffer.append(fieldName);
|
// buffer.append(fieldName);
|
||||||
// buffer.append('>');
|
// buffer.append('>');
|
||||||
// buffer.append(SystemUtils.LINE_SEPARATOR);
|
// buffer.append(SystemUtils.LINE_SEPARATOR);
|
||||||
// buffer.append(" ");
|
// buffer.append(" ");
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// /**
|
// /**
|
||||||
// * @see ToStringStyle#appendEnd(StringBuffer, Object)
|
// * @see ToStringStyle#appendEnd(StringBuffer, Object)
|
||||||
// */
|
// */
|
||||||
// public void appendEnd(StringBuffer buffer, Object object) {
|
// public void appendEnd(StringBuffer buffer, Object object) {
|
||||||
// int len = buffer.length();
|
// int len = buffer.length();
|
||||||
// if (len > 2 && buffer.charAt(len - 1) == ' ' && buffer.charAt(len - 2) == ' ') {
|
// if (len > 2 && buffer.charAt(len - 1) == ' ' && buffer.charAt(len - 2) == ' ') {
|
||||||
// buffer.setLength(len - 2);
|
// buffer.setLength(len - 2);
|
||||||
// }
|
// }
|
||||||
// buffer.append("</");
|
// buffer.append("</");
|
||||||
// buffer.append(getShortClassName(object.getClass()));
|
// buffer.append(getShortClassName(object.getClass()));
|
||||||
// buffer.append("\">");
|
// buffer.append("\">");
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue