db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r589926 - in /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata: ClassDescriptor.java FieldDescriptor.java
Date Tue, 30 Oct 2007 01:22:16 GMT
Author: arminw
Date: Mon Oct 29 18:22:16 2007
New Revision: 589926

URL: http://svn.apache.org/viewvc?rev=589926&view=rev
Log:
improved toString()

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java?rev=589926&r1=589925&r2=589926&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
Mon Oct 29 18:22:16 2007
@@ -2139,10 +2139,26 @@
             .append("factoryClass", factoryClass)
             .append("factoryMethod", factoryMethodName)
             .append("extendClassNames", getExtentClassNames().toString())
-            //.append("[fieldDescriptions:")
-            .append("#fields==>", ArrayUtils.toString(getFieldDescriptor(false)))
-            //.append("]")
+            .append("fields ==> ", getFieldNames())
             .toString();
+    }
+
+    private String getFieldNames()
+    {
+        StringBuffer result = new StringBuffer("[");
+        FieldDescriptor[] fields = getFieldDescriptor(false);
+        if(fields != null)
+        {
+            for(int i = 0; i < fields.length; i++)
+            {
+                if(i > 0) result.append(", ");
+                FieldDescriptor field = fields[i];
+                PersistentField pf = field != null ? field.getPersistentField() : null;
+                result.append((pf != null ? pf.getName() : "# NULL #"));
+            }
+        }
+        result.append("]");
+        return result.toString();
     }
 
     /*

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java?rev=589926&r1=589925&r2=589926&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java
Mon Oct 29 18:22:16 2007
@@ -281,6 +281,7 @@
     public String toString()
     {
         ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
+        buf.append("javaName", (getPersistentField() != null ? getPersistentField().getName()
: null));
         buf.append("columnName", m_ColumnName);
         buf.append("columnType", m_ColumnType);
         buf.append("isPrimaryKey", m_IsKeyField);
@@ -288,8 +289,11 @@
         buf.append("isAutoincrement", m_autoIncrement);
         buf.append("access", m_access);
         buf.append("sequenceName", m_sequenceName);
+        buf.append(SystemUtils.LINE_SEPARATOR);
         buf.append("jdbcType", m_jdbcType);
+        buf.append(SystemUtils.LINE_SEPARATOR);
         buf.append("null-check", nullCheck);
+        buf.append(SystemUtils.LINE_SEPARATOR);
         buf.append("super_class_fields ", "=> " + super.toString());
         buf.append(SystemUtils.LINE_SEPARATOR);
         return buf.toString();



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message