Also in the same commit

-            if ("date".equals(this.type))  return (new 
java.sql.Date(System.currentTimeMillis())).toString();
-            else if ("time".equals(this.type)) return (new 
java.sql.Time(System.currentTimeMillis())).toString();
-            else return UtilDateTime.nowTimestamp().toString();
+            if ("date".equals(this.type))
+                return (new 
java.sql.Date(System.currentTimeMillis())).toString();
+            else if ("time".equals(this.type))
+                return (new 
java.sql.Time(System.currentTimeMillis())).toString();
+            else
+                return UtilDateTime.nowTimestamp().toString();

We already discussed on this and I'd like to have a consensus

Personally I prefer the 1st form over the 2nd because it's less error prone. It's obvious you can't add a line. I know it's here returns, but it just an example there are much other cases like that (not returns) in this commit.

Of course best is the 2nd form when { } are used.

This said this was an huge overhaul, and I can understand why you skipped the { 
}

Jacques

Le 21/11/2014 14:08, Jacques Le Roux a écrit :
Hi Adrian,

I don't want to be nit picky, but I personnally prefer the 1st version (but the useless 
void after "} else if (" on 1st line)

Le 15/11/2014 22:33, [email protected] a écrit :
-            } else if (
-                "value".equals(modelField.getType())
-                    || "comment".equals(modelField.getType())
-                    || "description".equals(modelField.getType())
-                    || "long-varchar".equals(modelField.getType())
-                    || "url".equals(modelField.getType())
-                    || "email".equals(modelField.getType())) {
-                ModelFormField.TextFindField textField = new 
ModelFormField.TextFindField(ModelFormField.FieldInfo.SOURCE_AUTO_ENTITY, this);
+            } else if ("value".equals(modelField.getType()) || 
"comment".equals(modelField.getType())
+                    || "description".equals(modelField.getType()) || 
"long-varchar".equals(modelField.getType())
+                    || "url".equals(modelField.getType()) || 
"email".equals(modelField.getType())) {
+                ModelFormField.TextFindField textField = new 
ModelFormField.TextFindField(FieldInfo.SOURCE_AUTO_ENTITY, this);
                  textField.setSize(60);
                  textField.setMaxlength(Integer.valueOf(250));

I find it easier to read. I saw few blocks like this.

Jacques

Reply via email to