commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1364470 - /commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
Date Mon, 23 Jul 2012 00:41:28 GMT
Author: ggregory
Date: Mon Jul 23 00:41:28 2012
New Revision: 1364470

URL: http://svn.apache.org/viewvc?rev=1364470&view=rev
Log:
Make org.apache.commons.vfs2.FileSystemOptions.options final.

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java?rev=1364470&r1=1364469&r2=1364470&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
Mon Jul 23 00:41:28 2012
@@ -31,7 +31,20 @@ import java.util.TreeMap;
 public final class FileSystemOptions implements Cloneable
 {
     /** The options */
-    private Map<FileSystemOptionKey, Object> options = new TreeMap<FileSystemOptionKey,
Object>();
+    private final Map<FileSystemOptionKey, Object> options;
+
+    /**
+     * Creates a new instance.
+     */
+    public FileSystemOptions()
+    {
+        this(new TreeMap<FileSystemOptionKey, Object>());
+    }
+
+    protected FileSystemOptions(Map<FileSystemOptionKey, Object> options)
+    {
+        this.options = options;
+    }
 
     /**
      * Keys in the options Map.
@@ -102,10 +115,6 @@ public final class FileSystemOptions imp
         }
     }
 
-    public FileSystemOptions()
-    {
-    }
-
     void setOption(Class<? extends FileSystem> fileSystemClass, String name, Object
value)
     {
         options.put(new FileSystemOptionKey(fileSystemClass, name), value);
@@ -170,9 +179,7 @@ public final class FileSystemOptions imp
     @Override
     public Object clone()
     {
-        FileSystemOptions clone = new FileSystemOptions();
-        clone.options = new TreeMap<FileSystemOptionKey, Object>(options);
-        return clone;
+        return new FileSystemOptions(new TreeMap<FileSystemOptionKey, Object>(options));
     }
     
     @Override



Mime
View raw message