You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/09/18 21:23:53 UTC

[commons-configuration] 02/06: Sort members.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-configuration.git

commit dd735efced61e331c134627015177f095785e2ba
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Sep 18 16:42:49 2020 -0400

    Sort members.
---
 .../builder/FileBasedBuilderParametersImpl.java    | 246 ++++++++++-----------
 1 file changed, 123 insertions(+), 123 deletions(-)

diff --git a/src/main/java/org/apache/commons/configuration2/builder/FileBasedBuilderParametersImpl.java b/src/main/java/org/apache/commons/configuration2/builder/FileBasedBuilderParametersImpl.java
index 9b6c0a5..7b52431 100644
--- a/src/main/java/org/apache/commons/configuration2/builder/FileBasedBuilderParametersImpl.java
+++ b/src/main/java/org/apache/commons/configuration2/builder/FileBasedBuilderParametersImpl.java
@@ -60,35 +60,29 @@ public class FileBasedBuilderParametersImpl extends BasicBuilderParameters
             "reloadingDetectorFactory";
 
     /**
-     * Stores the associated file handler for the location of the configuration.
-     */
-    private FileHandler fileHandler;
-
-    /** The factory for reloading detectors. */
-    private ReloadingDetectorFactory reloadingDetectorFactory;
-
-    /** The refresh delay for reloading support. */
-    private Long reloadingRefreshDelay;
-
-    /**
-     * Creates a new instance of {@code FileBasedBuilderParametersImpl} with an
-     * uninitialized {@code FileHandler} object.
-     */
-    public FileBasedBuilderParametersImpl()
-    {
-        this(null);
-    }
-
-    /**
-     * Creates a new instance of {@code FileBasedBuilderParametersImpl} and
-     * associates it with the given {@code FileHandler} object. If the handler
-     * is <b>null</b>, a new handler instance is created.
+     * Creates a new {@code FileBasedBuilderParametersImpl} object from the
+     * content of the given map. While {@code fromParameters()} expects that an
+     * object already exists and is stored in the given map, this method creates
+     * a new instance based on the content of the map. The map can contain
+     * properties of a {@code FileHandler} and some additional settings which
+     * are stored directly in the newly created object. If the map is
+     * <b>null</b>, an uninitialized instance is returned.
      *
-     * @param handler the associated {@code FileHandler} (can be <b>null</b>)
+     * @param map the map with properties (must not be <b>null</b>)
+     * @return the newly created instance
+     * @throws ClassCastException if the map contains invalid data
      */
-    public FileBasedBuilderParametersImpl(final FileHandler handler)
+    public static FileBasedBuilderParametersImpl fromMap(final Map<String, ?> map)
     {
-        fileHandler = handler != null ? handler : new FileHandler();
+        final FileBasedBuilderParametersImpl params =
+                new FileBasedBuilderParametersImpl(FileHandler.fromMap(map));
+        if (map != null)
+        {
+            params.setReloadingRefreshDelay((Long) map.get(PROP_REFRESH_DELAY));
+            params.setReloadingDetectorFactory((ReloadingDetectorFactory) map
+                    .get(PROP_DETECTOR_FACTORY));
+        }
+        return params;
     }
 
     /**
@@ -137,60 +131,49 @@ public class FileBasedBuilderParametersImpl extends BasicBuilderParameters
     }
 
     /**
-     * Creates a new {@code FileBasedBuilderParametersImpl} object from the
-     * content of the given map. While {@code fromParameters()} expects that an
-     * object already exists and is stored in the given map, this method creates
-     * a new instance based on the content of the map. The map can contain
-     * properties of a {@code FileHandler} and some additional settings which
-     * are stored directly in the newly created object. If the map is
-     * <b>null</b>, an uninitialized instance is returned.
+     * Stores the associated file handler for the location of the configuration.
+     */
+    private FileHandler fileHandler;
+
+    /** The factory for reloading detectors. */
+    private ReloadingDetectorFactory reloadingDetectorFactory;
+
+    /** The refresh delay for reloading support. */
+    private Long reloadingRefreshDelay;
+
+    /**
+     * Creates a new instance of {@code FileBasedBuilderParametersImpl} with an
+     * uninitialized {@code FileHandler} object.
+     */
+    public FileBasedBuilderParametersImpl()
+    {
+        this(null);
+    }
+
+    /**
+     * Creates a new instance of {@code FileBasedBuilderParametersImpl} and
+     * associates it with the given {@code FileHandler} object. If the handler
+     * is <b>null</b>, a new handler instance is created.
      *
-     * @param map the map with properties (must not be <b>null</b>)
-     * @return the newly created instance
-     * @throws ClassCastException if the map contains invalid data
+     * @param handler the associated {@code FileHandler} (can be <b>null</b>)
      */
-    public static FileBasedBuilderParametersImpl fromMap(final Map<String, ?> map)
+    public FileBasedBuilderParametersImpl(final FileHandler handler)
     {
-        final FileBasedBuilderParametersImpl params =
-                new FileBasedBuilderParametersImpl(FileHandler.fromMap(map));
-        if (map != null)
-        {
-            params.setReloadingRefreshDelay((Long) map.get(PROP_REFRESH_DELAY));
-            params.setReloadingDetectorFactory((ReloadingDetectorFactory) map
-                    .get(PROP_DETECTOR_FACTORY));
-        }
-        return params;
+        fileHandler = handler != null ? handler : new FileHandler();
     }
 
     /**
-     * {@inheritDoc} This implementation takes some properties defined in this
-     * class into account.
+     * {@inheritDoc} This implementation also creates a copy of the
+     * {@code FileHandler}.
      */
     @Override
-    public void inheritFrom(final Map<String, ?> source)
+    public FileBasedBuilderParametersImpl clone()
     {
-        super.inheritFrom(source);
-
-        final FileBasedBuilderParametersImpl srcParams = fromParameters(source);
-        if (srcParams != null)
-        {
-            setFileSystem(srcParams.getFileHandler().getFileSystem());
-            setLocationStrategy(
-                    srcParams.getFileHandler().getLocationStrategy());
-            if (srcParams.getFileHandler().getEncoding() != null)
-            {
-                setEncoding(srcParams.getFileHandler().getEncoding());
-            }
-            if (srcParams.getReloadingDetectorFactory() != null)
-            {
-                setReloadingDetectorFactory(
-                        srcParams.getReloadingDetectorFactory());
-            }
-            if (srcParams.getReloadingRefreshDelay() != null)
-            {
-                setReloadingRefreshDelay(srcParams.getReloadingRefreshDelay());
-            }
-        }
+        final FileBasedBuilderParametersImpl copy =
+                (FileBasedBuilderParametersImpl) super.clone();
+        copy.fileHandler =
+                new FileHandler(fileHandler.getContent(), fileHandler);
+        return copy;
     }
 
     /**
@@ -205,22 +188,18 @@ public class FileBasedBuilderParametersImpl extends BasicBuilderParameters
     }
 
     /**
-     * Returns the refresh delay for reload operations. Result may be
-     * <b>null</b> if this value has not been set.
-     *
-     * @return the reloading refresh delay
+     * {@inheritDoc} This implementation returns a map which contains this
+     * object itself under a specific key. The static {@code fromParameters()}
+     * method can be used to extract an instance from a parameters map. Of
+     * course, the properties inherited from the base class are also added to
+     * the result map.
      */
-    public Long getReloadingRefreshDelay()
-    {
-        return reloadingRefreshDelay;
-    }
-
     @Override
-    public FileBasedBuilderParametersImpl setReloadingRefreshDelay(
-            final Long reloadingRefreshDelay)
+    public Map<String, Object> getParameters()
     {
-        this.reloadingRefreshDelay = reloadingRefreshDelay;
-        return this;
+        final Map<String, Object> params = super.getParameters();
+        params.put(PARAM_KEY, this);
+        return params;
     }
 
     /**
@@ -234,46 +213,73 @@ public class FileBasedBuilderParametersImpl extends BasicBuilderParameters
         return reloadingDetectorFactory;
     }
 
-    @Override
-    public FileBasedBuilderParametersImpl setReloadingDetectorFactory(
-            final ReloadingDetectorFactory reloadingDetectorFactory)
+    /**
+     * Returns the refresh delay for reload operations. Result may be
+     * <b>null</b> if this value has not been set.
+     *
+     * @return the reloading refresh delay
+     */
+    public Long getReloadingRefreshDelay()
     {
-        this.reloadingDetectorFactory = reloadingDetectorFactory;
-        return this;
+        return reloadingRefreshDelay;
     }
 
+    /**
+     * {@inheritDoc} This implementation takes some properties defined in this
+     * class into account.
+     */
     @Override
-    public FileBasedBuilderParametersImpl setFile(final File file)
+    public void inheritFrom(final Map<String, ?> source)
     {
-        getFileHandler().setFile(file);
-        return this;
+        super.inheritFrom(source);
+
+        final FileBasedBuilderParametersImpl srcParams = fromParameters(source);
+        if (srcParams != null)
+        {
+            setFileSystem(srcParams.getFileHandler().getFileSystem());
+            setLocationStrategy(
+                    srcParams.getFileHandler().getLocationStrategy());
+            if (srcParams.getFileHandler().getEncoding() != null)
+            {
+                setEncoding(srcParams.getFileHandler().getEncoding());
+            }
+            if (srcParams.getReloadingDetectorFactory() != null)
+            {
+                setReloadingDetectorFactory(
+                        srcParams.getReloadingDetectorFactory());
+            }
+            if (srcParams.getReloadingRefreshDelay() != null)
+            {
+                setReloadingRefreshDelay(srcParams.getReloadingRefreshDelay());
+            }
+        }
     }
 
     @Override
-    public FileBasedBuilderParametersImpl setURL(final URL url)
+    public FileBasedBuilderParametersImpl setBasePath(final String path)
     {
-        getFileHandler().setURL(url);
+        getFileHandler().setBasePath(path);
         return this;
     }
 
     @Override
-    public FileBasedBuilderParametersImpl setPath(final String path)
+    public FileBasedBuilderParametersImpl setEncoding(final String enc)
     {
-        getFileHandler().setPath(path);
+        getFileHandler().setEncoding(enc);
         return this;
     }
 
     @Override
-    public FileBasedBuilderParametersImpl setFileName(final String name)
+    public FileBasedBuilderParametersImpl setFile(final File file)
     {
-        getFileHandler().setFileName(name);
+        getFileHandler().setFile(file);
         return this;
     }
 
     @Override
-    public FileBasedBuilderParametersImpl setBasePath(final String path)
+    public FileBasedBuilderParametersImpl setFileName(final String name)
     {
-        getFileHandler().setBasePath(path);
+        getFileHandler().setFileName(name);
         return this;
     }
 
@@ -293,38 +299,32 @@ public class FileBasedBuilderParametersImpl extends BasicBuilderParameters
     }
 
     @Override
-    public FileBasedBuilderParametersImpl setEncoding(final String enc)
+    public FileBasedBuilderParametersImpl setPath(final String path)
     {
-        getFileHandler().setEncoding(enc);
+        getFileHandler().setPath(path);
         return this;
     }
 
-    /**
-     * {@inheritDoc} This implementation returns a map which contains this
-     * object itself under a specific key. The static {@code fromParameters()}
-     * method can be used to extract an instance from a parameters map. Of
-     * course, the properties inherited from the base class are also added to
-     * the result map.
-     */
     @Override
-    public Map<String, Object> getParameters()
+    public FileBasedBuilderParametersImpl setReloadingDetectorFactory(
+            final ReloadingDetectorFactory reloadingDetectorFactory)
     {
-        final Map<String, Object> params = super.getParameters();
-        params.put(PARAM_KEY, this);
-        return params;
+        this.reloadingDetectorFactory = reloadingDetectorFactory;
+        return this;
     }
 
-    /**
-     * {@inheritDoc} This implementation also creates a copy of the
-     * {@code FileHandler}.
-     */
     @Override
-    public FileBasedBuilderParametersImpl clone()
+    public FileBasedBuilderParametersImpl setReloadingRefreshDelay(
+            final Long reloadingRefreshDelay)
     {
-        final FileBasedBuilderParametersImpl copy =
-                (FileBasedBuilderParametersImpl) super.clone();
-        copy.fileHandler =
-                new FileHandler(fileHandler.getContent(), fileHandler);
-        return copy;
+        this.reloadingRefreshDelay = reloadingRefreshDelay;
+        return this;
+    }
+
+    @Override
+    public FileBasedBuilderParametersImpl setURL(final URL url)
+    {
+        getFileHandler().setURL(url);
+        return this;
     }
 }