Skip to content

Commit

Permalink
Updates:
Browse files Browse the repository at this point in the history
- Finished documentation updates
- Few minor spacing issues
- Switched from java.util.logging logger to SLF4J
  • Loading branch information
mciolkosz committed May 24, 2024
1 parent 2c2d26e commit 334c8c3
Show file tree
Hide file tree
Showing 16 changed files with 463 additions and 504 deletions.
16 changes: 11 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@
<version>24.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
Expand Down Expand Up @@ -138,7 +144,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.12.1</version>
<version>3.13.0</version>
<configuration>
<source>8</source>
<target>8</target>
Expand All @@ -147,7 +153,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -173,7 +179,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.1.0</version>
<version>3.2.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -195,7 +201,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<version>3.5.3</version>
<configuration>
<filters>
<filter>
Expand All @@ -219,7 +225,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
<version>3.1.2</version>
<configuration>
<skip>false</skip>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
import org.jetbrains.annotations.NotNull;

/**
* Various settings for controlling the input and output of a configuration.
* Represents the various settings for controlling the input and output of a
* configuration.
* <p>
* Synchronized with the commit on 13-March-2019.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public interface ConfigurationSection {
*/
@NotNull
@UnmodifiableView
List<String> getInLineComments(@NotNull final String path);
List<String> getInlineComments(@NotNull final String path);

/**
* Sets the comments at the given path.
Expand Down Expand Up @@ -274,7 +274,7 @@ public interface ConfigurationSection {
* {@code null} to remove any existing inline
* comments.
*/
void setInLineComments(@NotNull final String path, @Nullable final List<String> inLineComments);
void setInlineComments(@NotNull final String path, @Nullable final List<String> inLineComments);

/**
* Creates an empty configuration section at the given path.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import org.jetbrains.annotations.NotNull;

/**
* Various settings for controlling the input and output of a memory
* configuration.
* Represents the various settings for controlling the input and output of a
* memory configuration.
* <p>
* Synchronized with the commit on 13-March-2019.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,9 @@ public final List<String> getComments(@NotNull final String path) {
@Override
@NotNull
@UnmodifiableView
public final List<String> getInLineComments(@NotNull final String path) {
public final List<String> getInlineComments(@NotNull final String path) {
final SectionPathData data = this.getSectionPathData(path);
return data == null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList<String>(data.getInLineComments()));
return data == null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList<String>(data.getInlineComments()));
}

/**
Expand All @@ -331,10 +331,10 @@ public final void setComments(@NotNull final String path, @Nullable final List<S
* {@inheritDoc}
*/
@Override
public final void setInLineComments(@NotNull final String path, @Nullable final List<String> inLineComments) {
public final void setInlineComments(@NotNull final String path, @Nullable final List<String> inlineComments) {
final SectionPathData data = this.getSectionPathData(path);
if (data != null) {
data.setInLineComments(inLineComments);
data.setInlineComments(inlineComments);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void setData(@Nullable final Object data) {
* empty comment line ({@code #} and nothing else). Each entry in the list
* represents 1 line of comments.
* <p>
* The list cannot be modified. The returned list represents a snapshots of
* The list cannot be modified. The returned list represents a snapshot of
* the comments at the time the list was returned; any changes to the
* actual comments will not be reflected in this list.
*
Expand Down Expand Up @@ -134,15 +134,15 @@ void setComments(@Nullable final List<String> comments) {
* empty inline comment line ({@code #} and nothing else). Each entry in the
* list represents 1 line of inline comments.
* <p>
* The list cannot be modified. The returned list represents a snapshots of
* The list cannot be modified. The returned list represents a snapshot of
* the inline comments at the time the list was returned; any changes to the
* actual inline comments will not be reflected in this list.
*
* @return The inline comments for this section path data, where each list
* entry represents 1 line.
*/
@NotNull
List<String> getInLineComments() {
List<String> getInlineComments() {
return this.inLineComments;
}

Expand All @@ -166,7 +166,7 @@ List<String> getInLineComments() {
* @param inLineComments The inline comments to assign to this section path
* data.
*/
void setInLineComments(@Nullable final List<String> inLineComments) {
void setInlineComments(@Nullable final List<String> inLineComments) {
this.inLineComments = inLineComments == null ? Collections.emptyList() : Collections.unmodifiableList(new ArrayList<String>(inLineComments));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ protected FileConfiguration(@Nullable final Configuration defs) {
* @see FileConfiguration#saveToString()
*/
public final void save(@NotNull final File file) throws IOException {

if (!file.exists()) {
if (!file.createNewFile()) {
throw new IOException("File has not been created at " + file.getPath());
Expand Down Expand Up @@ -125,20 +126,17 @@ public final void save(@NotNull final String path) throws IOException {
public abstract String saveToString();

/**
* Loads this {@link FileConfiguration} from the given {@link Reader}.
* Loads this file configuration from the given reader.
* <p>
* All values contained in-memory in this {@link FileConfiguration} will be
* removed, leaving only the {@link FileConfigurationOptions} as well as any
* All values contained in-memory in this file configuration will be
* removed, leaving only the file configuration options as well as any
* defaults. The new values will be loaded into memory from the given
* {@link Reader}.
* reader.
*
* @param reader The {@link Reader} used to load this
* {@link FileConfiguration}.
* @throws IOException If the given {@link Reader} encounters an error and
* throws an {@link IOException}.
* @throws InvalidConfigurationException If the data in the {@link Reader}
* cannot be parsed as a
* {@link FileConfiguration}.
* @param reader The reader used to load this file configuration.
* @throws IOException If the given reader encounters an error.
* @throws InvalidConfigurationException If the data in the reader cannot be
* parsed as a file configuration.
* @see FileConfiguration#loadFromString(String)
*/
public final void load(@NotNull final Reader reader) throws IOException, InvalidConfigurationException {
Expand All @@ -159,57 +157,52 @@ public final void load(@NotNull final Reader reader) throws IOException, Invalid
}

/**
* Loads this {@link FileConfiguration} from the given {@link File}.
* Loads this file configuration from the given file.
* <p>
* All values contained in-memory in this {@link FileConfiguration} will be
* removed, leaving only the {@link FileConfigurationOptions} as well as any
* defaults. The new values will be loaded into memory from the given
* {@link File}.
* All values contained in-memory in this file configuration will be
* removed, leaving only the file configuration options as well as any
* defaults. The new values will be loaded into memory from the given file.
*
* @param file The {@link File} used to load this {@link FileConfiguration}.
* @throws IOException If the given {@link File} cannot be read.
* @throws InvalidConfigurationException If the data in the {@link File}
* cannot be parsed as a
* {@link FileConfiguration}.
* @param file The file used to load this file configuration.
* @throws IOException If the given file cannot be read.
* @throws InvalidConfigurationException If the data in the file cannot be
* parsed as a file configuration.
* @see FileConfiguration#load(Reader)
*/
public final void load(@NotNull final File file) throws IOException, InvalidConfigurationException {
this.load(new InputStreamReader(Files.newInputStream(file.toPath()), StandardCharsets.UTF_8));
}

/**
* Loads this {@link FileConfiguration} from a {@link File} at the given
* path.
* Loads this file configuration from the file at the given path.
* <p>
* All values contained in-memory in this {@link FileConfiguration} will be
* removed, leaving only the {@link FileConfigurationOptions} as well as any
* defaults. The new values will be loaded into memory from the {@link File}
* at the given path.
* All values contained in-memory in this file configuration will be
* removed, leaving only the file configuration options as well as any
* defaults. The new values will be loaded into memory from the file at the
* given path.
*
* @param path The path of the {@link File} to load from.
* @throws IOException If the {@link File} cannot be read.
* @throws InvalidConfigurationException If the data in the {@link File}
* cannot be parsed as a
* {@link FileConfiguration}.
* @param path The path of the file to load from.
* @throws IOException If the file cannot be read.
* @throws InvalidConfigurationException If the data in the file cannot be
* parsed as a file configuration.
* @see FileConfiguration#load(File)
*/
public final void load(@NotNull final String path) throws IOException, InvalidConfigurationException {
this.load(new File(path));
}

/**
* Loads this {@link FileConfiguration} from the given {@link String}.
* Loads this file configuration from the given string.
* <p>
* All values contained in-memory in this {@link FileConfiguration} will be
* removed, leaving only the {@link FileConfigurationOptions} as well as any
* defaults. The new values will be loaded into memory from the
* {@link String}.
* All values contained in-memory in this file configuration will be
* removed, leaving only the file configuration options as well as any
* defaults. The new values will be loaded into memory from the given
* string.
*
* @param data A {@link String} representation of the
* {@link FileConfiguration} data to load.
* @throws InvalidConfigurationException If the given {@link String} cannot
* be parsed as a
* {@link FileConfiguration}.
* @param data The string representation of the file configuration data to
* load.
* @throws InvalidConfigurationException If the given string cannot be
* parsed as a file configuration.
*/
public abstract void loadFromString(@NotNull final String data) throws InvalidConfigurationException;

Expand Down
Loading

0 comments on commit 334c8c3

Please sign in to comment.