jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1435213 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
Date Fri, 18 Jan 2013 16:05:51 GMT
Author: angela
Date: Fri Jan 18 16:05:50 2013
New Revision: 1435213

URL: http://svn.apache.org/viewvc?rev=1435213&view=rev
Log:
minor improvement

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java?rev=1435213&r1=1435212&r2=1435213&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/NodeTypeTemplateImpl.java
Fri Jan 18 16:05:50 2013
@@ -16,23 +16,8 @@
  */
 package org.apache.jackrabbit.oak.plugins.nodetype.write;
 
-import static org.apache.jackrabbit.JcrConstants.JCR_CHILDNODEDEFINITION;
-import static org.apache.jackrabbit.JcrConstants.JCR_HASORDERABLECHILDNODES;
-import static org.apache.jackrabbit.JcrConstants.JCR_ISMIXIN;
-import static org.apache.jackrabbit.JcrConstants.JCR_NODETYPENAME;
-import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYITEMNAME;
-import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
-import static org.apache.jackrabbit.JcrConstants.JCR_PROPERTYDEFINITION;
-import static org.apache.jackrabbit.JcrConstants.JCR_SUPERTYPES;
-import static org.apache.jackrabbit.JcrConstants.NT_CHILDNODEDEFINITION;
-import static org.apache.jackrabbit.JcrConstants.NT_NODETYPE;
-import static org.apache.jackrabbit.JcrConstants.NT_PROPERTYDEFINITION;
-import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_IS_ABSTRACT;
-import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_IS_QUERYABLE;
-
 import java.util.Arrays;
 import java.util.List;
-
 import javax.annotation.Nonnull;
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ConstraintViolationException;
@@ -44,11 +29,24 @@ import javax.jcr.nodetype.NodeTypeTempla
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.nodetype.PropertyDefinitionTemplate;
 
+import com.google.common.collect.Lists;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 
-import com.google.common.collect.Lists;
+import static org.apache.jackrabbit.JcrConstants.JCR_CHILDNODEDEFINITION;
+import static org.apache.jackrabbit.JcrConstants.JCR_HASORDERABLECHILDNODES;
+import static org.apache.jackrabbit.JcrConstants.JCR_ISMIXIN;
+import static org.apache.jackrabbit.JcrConstants.JCR_NODETYPENAME;
+import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYITEMNAME;
+import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.JcrConstants.JCR_PROPERTYDEFINITION;
+import static org.apache.jackrabbit.JcrConstants.JCR_SUPERTYPES;
+import static org.apache.jackrabbit.JcrConstants.NT_CHILDNODEDEFINITION;
+import static org.apache.jackrabbit.JcrConstants.NT_NODETYPE;
+import static org.apache.jackrabbit.JcrConstants.NT_PROPERTYDEFINITION;
+import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_IS_ABSTRACT;
+import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_IS_QUERYABLE;
 
 class NodeTypeTemplateImpl extends NamedTemplate
         implements NodeTypeTemplate {
@@ -98,9 +96,9 @@ class NodeTypeTemplateImpl extends Named
         if (pds != null) {
             propertyDefinitionTemplates =
                     Lists.newArrayListWithCapacity(pds.length);
-            for (int i = 0; pds != null && i < pds.length; i++) {
+            for (PropertyDefinition pd : pds) {
                 propertyDefinitionTemplates.add(
-                        new PropertyDefinitionTemplateImpl(mapper, pds[i]));
+                        new PropertyDefinitionTemplateImpl(mapper, pd));
             }
         }
 
@@ -108,9 +106,9 @@ class NodeTypeTemplateImpl extends Named
         if (nds != null) {
             nodeDefinitionTemplates =
                     Lists.newArrayListWithCapacity(nds.length);
-            for (int i = 0; i < nds.length; i++) {
+            for (NodeDefinition nd : nds) {
                 nodeDefinitionTemplates.add(
-                        new NodeDefinitionTemplateImpl(mapper, nds[i]));
+                        new NodeDefinitionTemplateImpl(mapper, nd));
             }
         }
     }
@@ -123,6 +121,7 @@ class NodeTypeTemplateImpl extends Named
      *
      * @param parent parent node under which to write this node type
      * @param allowUpdate whether to overwrite an existing type
+     * @return The node type tree.
      * @throws RepositoryException if this type could not be written
      */
     Tree writeTo(Tree parent, boolean allowUpdate) throws RepositoryException {
@@ -142,7 +141,7 @@ class NodeTypeTemplateImpl extends Named
         type.setProperty(JCR_PRIMARYTYPE, NT_NODETYPE, Type.NAME);
         type.setProperty(JCR_NODETYPENAME, oakName, Type.NAME);
 
-        if (superTypeOakNames != null && superTypeOakNames.length > 0) {
+        if (superTypeOakNames.length > 0) {
             type.setProperty(
                     JCR_SUPERTYPES,
                     Arrays.asList(superTypeOakNames), Type.NAMES);



Mime
View raw message