package jpower.core.config;

import jpower.core.load.Loadable;
import jpower.core.load.Reloadable;
import jpower.core.utils.ExceptionUtils;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;

/**
 * Configuration File Wrapper
 */
public class ConfigFile implements Loadable, Reloadable
{
   private final Path path;
   private final Configuration configuration = new Configuration();

   /**
    * Creates a ConfigFile from the path
    *
    * @param path path
    */
   public ConfigFile(Path path)
   {
      this.path = path;
   }

   /**
    * Creates a ConfigFile from the file
    * @param file file
    */
   public ConfigFile(File file)
   {
      this.path = file.toPath();
   }

   /**
    * Loads the Configuration File
    */
   @Override
   public void load()
   {
      try
      {
         configuration.load(path.toFile());
      }
      catch (IOException e)
      {
         ExceptionUtils.throwUnchecked(e);
      }
   }

   /**
    * Reloads the Configuration File
    */
   @Override
   public void reload()
   {
      configuration.reset();
      load();
   }

   /**
    * Gets the Configuration from the File
    * @return configuration
    */
   public Configuration getConfiguration()
   {
      return configuration;
   }
}

@@ -324,25 +324,25 @@
 e final 
-Path path
+File file
 ;%0A   pri
@@ -419,32 +419,38 @@
     * Creates a 
+@link%7B
 ConfigFile from 
@@ -435,32 +435,33 @@
 @link%7BConfigFile
+%7D
  from the path%0A 
@@ -454,17 +454,17 @@
 rom the 
-p
+P
 ath%0A    
@@ -483,20 +483,55 @@
 am path 
-pa
 th
+e path to load the configuration from
 %0A    */%0A
@@ -581,20 +581,23 @@
 this
-.
+(
 path
- = path
+.toFile())
 ;%0A  
@@ -623,16 +623,23 @@
 eates a 
+%7B@link 
 ConfigFi
@@ -640,16 +640,17 @@
 nfigFile
+%7D
  from th
@@ -674,20 +674,55 @@
 am file 
-file
+the file to load the configuration from
 %0A    */%0A
@@ -773,28 +773,19 @@
 his.
-path
+file
  = file
-.toPath()
 ;%0A  
@@ -803,33 +803,33 @@
     * Loads the 
-C
+c
 onfiguration Fil
@@ -817,33 +817,33 @@
 e configuration 
-F
+f
 ile%0A    */%0A   @O
@@ -923,29 +923,20 @@
 on.load(
-path.toF
+f
 ile
-()
 );%0A     
@@ -1052,25 +1052,25 @@
 Reloads the 
-C
+c
 onfiguration
@@ -1070,17 +1070,17 @@
 uration 
-F
+f
 ile%0A    
@@ -1195,16 +1195,23 @@
 ets the 
+%7B@link 
 Configur
@@ -1211,24 +1211,25 @@
 onfiguration
+%7D
  from the Fi

Fix Silly Code and cleanup JavaDoc