diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java b/Core/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java index 661898269..496a2775a 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java @@ -27,12 +27,12 @@ public interface ConfigurationSection { /** * Gets a Map containing all keys and their values for this section. - *

- * If deep is set to true, then this will contain all the keys and values + * + *

If deep is set to true, then this will contain all the keys and values * within any child {@link ConfigurationSection}s (and their children, * etc). These keys will be in a valid path notation for you to use. - *

- * If deep is set to false, then this will contain only the keys and + * + *

If deep is set to false, then this will contain only the keys and * values of any direct children, and not their own children. * * @param deep Whether or not to get a deep list, as opposed to a shallow @@ -49,8 +49,8 @@ public interface ConfigurationSection { * * @param path Path to check for existence. * @return True if this section contains the requested path, either via - * default or being set. - * @throws IllegalArgumentException Thrown when path is null. + * default or being set. + * @throws IllegalArgumentException Thrown when path is {@code null}. */ boolean contains(String path); @@ -64,7 +64,7 @@ public interface ConfigurationSection { * @param path Path to check for existence. * @return True if this section contains the requested path, regardless of * having a default. - * @throws IllegalArgumentException Thrown when path is null. + * @throws IllegalArgumentException Thrown when path is {@code null}. */ boolean isSet(String path); @@ -77,7 +77,7 @@ public interface ConfigurationSection { * *

If the section is no longer contained within its root for any reason, * such as being replaced with a different value, - * this may return null. + * this may return {@code null}. * *

To retrieve the single name of this section, that is, the final part * of the path returned by this method, you may use {@link #getName()}. @@ -106,7 +106,7 @@ public interface ConfigurationSection { * *

If the section is no longer contained within its root for any reason, * such as being replaced with a different value, - * this may return null. + * this may return {@code null}. * * @return Root configuration containing this section. */ @@ -117,11 +117,11 @@ public interface ConfigurationSection { * this {@link ConfigurationSection}. * *

For any {@link Configuration} themselves, this will return - * null. + * {@code null}. * - *

If the section is no longer contained within its parent for any reason, - * such as being replaced with a different value, this may - * return null. + *

If the section is no longer contained within its parent for any + * reason, such as being replaced with a different value, this may + * return {@code null}. * * @return Parent section containing this section. */ @@ -132,7 +132,7 @@ public interface ConfigurationSection { * *

If the Object does not exist but a default value has been specified, * this will return the default value. If the Object does not exist and no - * default value was specified, this will return null. + * default value was specified, this will return {@code null}. * * @param path Path of the Object to get. * @return Requested Object. @@ -156,7 +156,7 @@ public interface ConfigurationSection { /** * Sets the specified path to the given value. * - *

If value is null, the entry will be removed. Any + *

If value is {@code null}, the entry will be removed. Any * existing entry will be replaced, regardless of what the new value is. * *

Some implementations may have limitations on what you may store. See @@ -202,7 +202,7 @@ public interface ConfigurationSection { * *

If the String does not exist but a default value has been specified, * this will return the default value. If the String does not exist and no - * default value was specified, this will return null. + * default value was specified, this will return {@code null}. * * @param path Path of the String to get. * @return Requested String. @@ -470,13 +470,13 @@ public interface ConfigurationSection { /** * Gets the requested List of Boolean by path. - *

- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *

If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *

- * This method will attempt to cast any values into a Boolean if possible, - * but may miss any values out if they are not compatible. + * + *

This method will attempt to cast any values into a Boolean if + * possible, but may miss any values out if they are not compatible. * * @param path Path of the List to get. * @return Requested List of Boolean. @@ -485,12 +485,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Double by path. - *

- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *

If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *

- * This method will attempt to cast any values into a Double if possible, + * + *

This method will attempt to cast any values into a Double if possible, * but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -500,12 +500,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Float by path. - *

- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *

If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *

- * This method will attempt to cast any values into a Float if possible, + * + *

This method will attempt to cast any values into a Float if possible, * but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -515,12 +515,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Long by path. - *

- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *

If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *

- * This method will attempt to cast any values into a Long if possible, + * + *

This method will attempt to cast any values into a Long if possible, * but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -530,12 +530,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Byte by path. - *

- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *

If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *

- * This method will attempt to cast any values into a Byte if possible, + * + *

This method will attempt to cast any values into a Byte if possible, * but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -545,12 +545,12 @@ public interface ConfigurationSection { /** * Gets the requested List of Character by path. - *

- * If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *

If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *

- * This method will attempt to cast any values into a Character if + * + *

This method will attempt to cast any values into a Character if * possible, but may miss any values out if they are not compatible. * * @param path Path of the List to get. @@ -560,11 +560,13 @@ public interface ConfigurationSection { /** * Gets the requested List of Short by path. - *

If the List does not exist but a default value has been specified, this - * will return the default value. If the List does not exist and no + * + *

If the List does not exist but a default value has been specified, + * this will return the default value. If the List does not exist and no * default value was specified, this will return an empty List. - *

This method will attempt to cast any values into a Short if possible, - * but may miss any values out if they are not compatible. + * + *

This method will attempt to cast any values into a Short if + * possible, but may miss any values out if they are not compatible. * * @param path Path of the List to get. * @return Requested List of Short. @@ -591,7 +593,7 @@ public interface ConfigurationSection { *

If the ConfigurationSection does not exist but a default value has * been specified, this will return the default value. If the * ConfigurationSection does not exist and no default value was specified, - * this will return null. + * this will return {@code null}. * * @param path Path of the ConfigurationSection to get. * @return Requested ConfigurationSection. @@ -618,7 +620,7 @@ public interface ConfigurationSection { * *

If the root contains no defaults, or the defaults doesn't contain a * value for this path, or the value at this path is not a {@link - * ConfigurationSection} then this will return null. + * ConfigurationSection} then this will return {@code null}. * * @return Equivalent section in root configuration */ @@ -631,16 +633,16 @@ public interface ConfigurationSection { * collection, then a new {@link MemoryConfiguration} will be created to * hold the new default value. * - *

If value is null, the value will be removed from the + *

If value is {@code null}, the value will be removed from the * default Configuration source. * *

If the value as returned by {@link #getDefaultSection()} is - * null, then this will create a new section at the path, + * {@code null}, then this will create a new section at the path, * replacing anything that may have existed there previously. * * @param path Path of the value to set * @param value Value to set the default to - * @throws IllegalArgumentException Thrown if path is null + * @throws IllegalArgumentException Thrown if path is {@code null} */ void addDefault(String path, Object value); } diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java b/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java index 8aad3c8d9..d2e0aafa3 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/MemorySection.java @@ -74,7 +74,8 @@ public class MemorySection implements ConfigurationSection { if (obj instanceof String) { try { return Double.parseDouble((String) obj); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } } else if (obj instanceof List) { List val = (List) obj; if (!val.isEmpty()) { @@ -91,7 +92,8 @@ public class MemorySection implements ConfigurationSection { if (obj instanceof String) { try { return Integer.parseInt((String) obj); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } } else if (obj instanceof List) { List val = (List) obj; if (!val.isEmpty()) { @@ -108,7 +110,8 @@ public class MemorySection implements ConfigurationSection { if (obj instanceof String) { try { return Long.parseLong((String) obj); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } } else if (obj instanceof List) { List val = (List) obj; if (!val.isEmpty()) { @@ -565,7 +568,8 @@ public class MemorySection implements ConfigurationSection { } else if (object instanceof String) { try { result.add(Integer.valueOf((String) object)); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } } else if (object instanceof Character) { result.add((int) (Character) object); } else if (object instanceof Number) { @@ -609,7 +613,8 @@ public class MemorySection implements ConfigurationSection { } else if (object instanceof String) { try { result.add(Double.valueOf((String) object)); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } } else if (object instanceof Character) { result.add((double) (Character) object); } else if (object instanceof Number) { @@ -632,7 +637,8 @@ public class MemorySection implements ConfigurationSection { } else if (object instanceof String) { try { result.add(Float.valueOf((String) object)); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } } else if (object instanceof Character) { result.add((float) (Character) object); } else if (object instanceof Number) { @@ -655,7 +661,8 @@ public class MemorySection implements ConfigurationSection { } else if (object instanceof String) { try { result.add(Long.valueOf((String) object)); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } } else if (object instanceof Character) { result.add((long) (Character) object); } else if (object instanceof Number) { @@ -678,7 +685,8 @@ public class MemorySection implements ConfigurationSection { } else if (object instanceof String) { try { result.add(Byte.valueOf((String) object)); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } } else if (object instanceof Character) { result.add((byte) ((Character) object).charValue()); } else if (object instanceof Number) { @@ -724,7 +732,8 @@ public class MemorySection implements ConfigurationSection { } else if (object instanceof String) { try { result.add(Short.valueOf((String) object)); - } catch (NumberFormatException ignored) {} + } catch (NumberFormatException ignored) { + } } else if (object instanceof Character) { result.add((short) ((Character) object).charValue()); } else if (object instanceof Number) { @@ -833,7 +842,10 @@ public class MemorySection implements ConfigurationSection { @Override public String toString() { Configuration root = getRoot(); - return getClass().getSimpleName() + "[path='" + getCurrentPath() + "', root='" + (root == null ? null : root.getClass().getSimpleName()) + - "']"; + if (root == null) { + return getClass().getSimpleName() + "[path='" + getCurrentPath() + "', root='" + null + "']"; + } else { + return getClass().getSimpleName() + "[path='" + getCurrentPath() + "', root='" + root.getClass().getSimpleName() + "']"; + } } } diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java b/Core/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java index d99eab2da..a2c1c19e6 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java @@ -42,8 +42,8 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions { * automatically be applied, but you may include one if you wish for extra * spacing. * - *

null is a valid value which will indicate that no header] - * is to be applied. The default value is null. + *

{@code null} is a valid value which will indicate that no header] + * is to be applied. The default value is {@code null}. * * @return Header */ @@ -60,7 +60,7 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions { * automatically be applied, but you may include one if you wish for extra * spacing. * - *

null is a valid value which will indicate that no header + *

{@code null} is a valid value which will indicate that no header * is to be applied. * * @param value New header diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlConfigurationOptions.java b/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlConfigurationOptions.java index d33416387..242b40640 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlConfigurationOptions.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlConfigurationOptions.java @@ -2,12 +2,12 @@ package com.intellectualcrafters.configuration.file; /** * Various settings for controlling the input and output of a {@link - * YamlConfiguration} + * YamlConfiguration}. */ public class YamlConfigurationOptions extends FileConfigurationOptions { private int indent = 2; - YamlConfigurationOptions(final YamlConfiguration configuration) { + YamlConfigurationOptions(YamlConfiguration configuration) { super(configuration); } @@ -17,33 +17,33 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { } @Override - public YamlConfigurationOptions copyDefaults(final boolean value) { + public YamlConfigurationOptions copyDefaults(boolean value) { super.copyDefaults(value); return this; } @Override - public YamlConfigurationOptions pathSeparator(final char value) { + public YamlConfigurationOptions pathSeparator(char value) { super.pathSeparator(value); return this; } @Override - public YamlConfigurationOptions header(final String value) { + public YamlConfigurationOptions header(String value) { super.header(value); return this; } @Override - public YamlConfigurationOptions copyHeader(final boolean value) { + public YamlConfigurationOptions copyHeader(boolean value) { super.copyHeader(value); return this; } /** * Gets how much spaces should be used to indent each line. - *

- * The minimum value this may be is 2, and the maximum is 9. + * + *

The minimum value this may be is 2, and the maximum is 9. * * @return How much to indent by */ @@ -53,13 +53,13 @@ public class YamlConfigurationOptions extends FileConfigurationOptions { /** * Sets how much spaces should be used to indent each line. - *

- * The minimum value this may be is 2, and the maximum is 9. + * + *

The minimum value this may be is 2, and the maximum is 9. * * @param value New indent * @return This object, for chaining */ - public YamlConfigurationOptions indent(final int value) { + public YamlConfigurationOptions indent(int value) { if (value < 2) { throw new IllegalArgumentException("Indent must be at least 2 characters"); } diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java b/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java index 61eecfa1c..e130e5d94 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java @@ -11,7 +11,7 @@ import java.util.Map; class YamlRepresenter extends Representer { - public YamlRepresenter() { + YamlRepresenter() { this.multiRepresenters.put(ConfigurationSection.class, new RepresentConfigurationSection()); this.multiRepresenters.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable()); } diff --git a/Core/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerializable.java b/Core/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerializable.java index 7ee49ae5f..fed1b35b9 100644 --- a/Core/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerializable.java +++ b/Core/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerializable.java @@ -4,9 +4,8 @@ import java.util.Map; /** * Represents an object that may be serialized. - *

- * These objects MUST implement one of the following, in addition to the - * methods as defined by this interface: + *

These objects MUST implement one of the following, in addition to + * the methods as defined by this interface: *