jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1342309 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: namespace/NamespaceRegistryImpl.java nodetype/ItemDefinitionDelegate.java nodetype/NodeTypeManagerImpl.java
Date Thu, 24 May 2012 16:04:25 GMT
Author: mduerig
Date: Thu May 24 16:04:25 2012
New Revision: 1342309

URL: http://svn.apache.org/viewvc?rev=1342309&view=rev
Log:
cleanup:
- make methods which don't modify the object's state static
- make fields final where possible

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java?rev=1342309&r1=1342308&r2=1342309&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/namespace/NamespaceRegistryImpl.java
Thu May 24 16:04:25 2012
@@ -16,16 +16,15 @@
  */
 package org.apache.jackrabbit.oak.jcr.namespace;
 
-import java.util.Locale;
+import org.apache.jackrabbit.oak.api.CommitFailedException;
+import org.apache.jackrabbit.oak.api.ContentSession;
+import org.apache.jackrabbit.oak.plugins.name.NamespaceMappings;
 
 import javax.annotation.Nonnull;
 import javax.jcr.NamespaceException;
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.RepositoryException;
-
-import org.apache.jackrabbit.oak.api.CommitFailedException;
-import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.plugins.name.NamespaceMappings;
+import java.util.Locale;
 
 /**
  * Implementation of {@link NamespaceRegistry} based on {@link NamespaceMappings}.
@@ -124,17 +123,17 @@ public class NamespaceRegistryImpl imple
         }
     }
 
-    private void checkMutablePrefix(String prefix) throws NamespaceException {
+    private static void checkMutablePrefix(String prefix) throws NamespaceException {
         if ("jcr".equals(prefix) || "nt".equals(prefix) || "mix".equals(prefix) || "sv".equals(prefix)
                 || prefix.toLowerCase(Locale.ENGLISH).startsWith("xml")) {
-            throw new NamespaceException("Can not map or remap prefix '" + prefix + "'");
+            throw new NamespaceException("Can not map or remap prefix '" + prefix + '\'');
         }
     }
 
-    private void checkMutableURI(String uri) throws NamespaceException {
+    private static void checkMutableURI(String uri) throws NamespaceException {
         if ("http://www.jcp.org/jcr/1.0".equals(uri) || "http://www.jcp.org/jcr/nt/1.0".equals(uri)
                 || "http://www.jcp.org/jcr/mix/1.0".equals(uri) || "http://www.jcp.org/jcr/sv/1.0".equals(uri))
{
-            throw new NamespaceException("Can not map or remap uri '" + uri + "'");
+            throw new NamespaceException("Can not map or remap uri '" + uri + '\'');
         }
     }
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionDelegate.java?rev=1342309&r1=1342308&r2=1342309&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/ItemDefinitionDelegate.java
Thu May 24 16:04:25 2012
@@ -18,11 +18,11 @@ package org.apache.jackrabbit.oak.jcr.no
 
 public class ItemDefinitionDelegate {
 
-    private String name;
-    private boolean autoCreated;
-    private boolean mandatory;
-    private int onParentVersion;
-    private boolean isProtected;
+    private final String name;
+    private final boolean autoCreated;
+    private final boolean mandatory;
+    private final int onParentVersion;
+    private final boolean isProtected;
 
     protected ItemDefinitionDelegate(String name, boolean autoCreated, boolean mandatory,
int onParentVersion, boolean isProtected) {
         this.name = name;

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java?rev=1342309&r1=1342308&r2=1342309&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/nodetype/NodeTypeManagerImpl.java
Thu May 24 16:04:25 2012
@@ -214,13 +214,13 @@ public class NodeTypeManagerImpl impleme
 
     private class NodeTypeDefinitionDelegateBuilder extends AbstractNodeTypeDefinitionBuilder<NodeTypeDelegate>
{
 
-        private List<PropertyDefinitionDelegateBuilder> propertyDefinitions = new ArrayList<PropertyDefinitionDelegateBuilder>();
-        private List<NodeDefinitionDelegateBuilder> childNodeDefinitions = new ArrayList<NodeDefinitionDelegateBuilder>();
+        private final List<PropertyDefinitionDelegateBuilder> propertyDefinitions =
new ArrayList<PropertyDefinitionDelegateBuilder>();
+        private final List<NodeDefinitionDelegateBuilder> childNodeDefinitions = new
ArrayList<NodeDefinitionDelegateBuilder>();
 
         private final ValueFactoryImpl vf;
 
         private String primaryItemName;
-        private List<String> declaredSuperTypes = new ArrayList<String>();
+        private final List<String> declaredSuperTypes = new ArrayList<String>();
 
         public NodeTypeDefinitionDelegateBuilder(ValueFactoryImpl vf) {
             this.vf = vf;
@@ -276,7 +276,7 @@ public class NodeTypeManagerImpl impleme
 
         private String declaringNodeType;
         private String defaultPrimaryType;
-        private List<String> requiredPrimaryTypes = new ArrayList<String>();
+        private final List<String> requiredPrimaryTypes = new ArrayList<String>();
 
         private final NodeTypeDefinitionDelegateBuilder ndtb;
 
@@ -287,7 +287,7 @@ public class NodeTypeManagerImpl impleme
         public NodeDefinitionDelegate getNodeDefinitionDelegate() {
             return new NodeDefinitionDelegate(name, autocreate, isMandatory, onParent, isProtected,
                     requiredPrimaryTypes.toArray(new String[requiredPrimaryTypes.size()]),
defaultPrimaryType, allowSns);
-        };
+        }
 
         @Override
         public void setDefaultPrimaryType(String defaultPrimaryType) throws RepositoryException
{
@@ -313,8 +313,8 @@ public class NodeTypeManagerImpl impleme
     private class PropertyDefinitionDelegateBuilder extends AbstractPropertyDefinitionBuilder<NodeTypeDelegate>
{
 
         private String declaringNodeType;
-        private List<String> defaultValues = new ArrayList<String>();
-        private List<String> valueConstraints = new ArrayList<String>();
+        private final List<String> defaultValues = new ArrayList<String>();
+        private final List<String> valueConstraints = new ArrayList<String>();
 
         private final NodeTypeDefinitionDelegateBuilder ndtb;
 



Mime
View raw message