You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@depot.apache.org by ni...@apache.org on 2004/05/21 07:49:04 UTC

svn commit: rev 20189 - incubator/depot/trunk/version/src/java/org/apache/depot/version/impl

Author: nickchalko
Date: Fri May 21 00:49:03 2004
New Revision: 20189

Modified:
   incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
Log:
Use the VersionFormat class.

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java	Fri May 21 00:49:03 2004
@@ -37,7 +37,9 @@
 import org.apache.depot.version.impl.data.util.VersionDataIncrementor;
 import org.apache.depot.version.specification.VersionSpecification;
 import org.apache.depot.version.specification.VersionSpecificationFactory;
+import org.apache.depot.version.specification.formatting.VersionFormat;
 import org.apache.depot.version.specification.formatting.VersionFormatException;
+import org.apache.depot.version.specification.formatting.format.ApacheVersionFormat;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -48,8 +50,9 @@
 	implements Version, CompoundVersion, Dumpable, DOMProducer, DOMConsumer {
 
 	public final static String VERSION_TAG = "version";
+	
 
-	private VersionSpecification m_specification;
+	private final VersionSpecification m_specification;
 	private VersionData m_data;
 
 	public static ApacheVersion fromVersion(Version version)
@@ -776,21 +779,8 @@
 	}
 
 	public String toString() {
-		StringBuffer buffer = new StringBuffer();
-
-		if (null != m_data) {
-			if (buffer.length() > 0)
-				buffer.append("|");
-			buffer.append(m_data.toString());
-		}
-
-		//if (null != m_specification) {
-		//    if (buffer.length() > 0)
-		//        buffer.append("|");
-		//
-		//          buffer.append(m_specification.toString());
-		//    }
-		return buffer.toString();
+		// TODO handle this in a parent class.
+		return m_specification.getVersionFormat().toVersionString(getVersionData());
 	}
 
 	public void dump(PrintWriter out, int depth, boolean verbose) {