Skip to content

Commit

Permalink
m'javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGlitch76 committed Jul 1, 2023
1 parent 9625aef commit caf106b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 130 deletions.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
166 changes: 37 additions & 129 deletions src/main/java/org/quiltmc/loader/api/config/v2/QuiltConfig.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
/*
* Copyright 2023 QuiltMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.quiltmc.loader.api.config.v2;

import org.quiltmc.config.api.Config;
import org.quiltmc.config.api.ReflectiveConfig;
import org.quiltmc.config.api.annotations.ConfigFieldAnnotationProcessor;
import org.quiltmc.config.api.values.ValueList;
import org.quiltmc.config.api.values.ValueMap;
import org.quiltmc.config.impl.ConfigImpl;
import org.quiltmc.config.implementor_api.ConfigFactory;
import org.quiltmc.loader.impl.config.QuiltConfigImpl;
Expand Down Expand Up @@ -36,23 +55,8 @@ public static Config create(String family, String id, Config.Creator... creators
}

/**
* Creates and registers a config with fields derived from the fields of the passed class
*
* <p>The passed class should have the following characteristics:
* <ul>
* <li>Has a public no-argument constructor</li>
* <li>Each non-static non-transient field should be final, not null, and be one of the following types:</li>
* <ul>
* <li>A basic type (int, long, float, double, boolean, String, or enum)</li>
* <li>A complex type (a {@link ValueList} or {@link ValueMap} of basic or complex types or a {@link org.quiltmc.config.api.values.ConfigSerializableObject})</li>
* <li>An object whose class follows these rules</li>
* </ul>
* </ul>
*
* <p>Certain annotations can also be used on fields of this class to attach metadata to them. The {@link org.quiltmc.config.api.annotations.Comment}
* annotation is one such annotation that is provided by default, but additional {@link ConfigFieldAnnotationProcessor}s
* can be registered with {@link ConfigFieldAnnotationProcessor#register(Class, ConfigFieldAnnotationProcessor)}.
*
* Creates and registers a config with a class that contains its WrappedValues as fields.
*
* @param family the mod owning the resulting config file
* @param id the config's id
* @param path additional path elements to include as part of this configs file, e.g.
Expand All @@ -61,29 +65,14 @@ public static Config create(String family, String id, Config.Creator... creators
* @param before a {@link Config.Creator} that can be used to configure the resulting config further
* @param configCreatorClass a class as described above
* @param after a {@link Config.Creator} that can be used to configure the resulting config further
* @return a {@link WrappedConfig <C>}
* @return a {@link ReflectiveConfig <C>}
*/
public static <C extends ReflectiveConfig> C create(String family, String id, Path path, Config.Creator before, Class<C> configCreatorClass, Config.Creator after) {
return ConfigFactory.create(QuiltConfigImpl.getConfigEnvironment(), family, id, path, before, configCreatorClass, after);
}

/**
* Creates and registers a config with fields derived from the fields of the passed class
*
* <p>The passed class should have the following characteristics:
* <ul>
* <li>Has a public no-argument constructor</li>
* <li>Each non-static non-transient field should be final, not null, and be one of the following types:</li>
* <ul>
* <li>A basic type (int, long, float, double, boolean, String, or enum)</li>
* <li>A complex type (a {@link ValueList} or {@link ValueMap} of basic or complex types or a {@link org.quiltmc.config.api.values.ConfigSerializableObject})</li>
* <li>An object whose class follows these rules</li>
* </ul>
* </ul>
*
* <p>Certain annotations can also be used on fields of this class to attach metadata to them. The {@link org.quiltmc.config.api.annotations.Comment}
* annotation is one such annotation that is provided by default, but additional {@link ConfigFieldAnnotationProcessor}s
* can be registered with {@link ConfigFieldAnnotationProcessor#register(Class, ConfigFieldAnnotationProcessor)}.
* Creates and registers a config with a class that contains its WrappedValues as fields.
*
* @param family the mod owning the resulting config file
* @param id the config's id
Expand All @@ -92,29 +81,14 @@ public static <C extends ReflectiveConfig> C create(String family, String id, Pa
* if the path is "client/gui", the config file might be ".minecraft/config/example_mod/client/gui/id.toml"
* @param before a {@link Config.Creator} that can be used to configure the resulting config further
* @param configCreatorClass a class as described above
* @return a {@link WrappedConfig <C>}
* @return a {@link ReflectiveConfig <C>}
*/
public static <C extends ReflectiveConfig> C create(String family, String id, Path path, Config.Creator before, Class<C> configCreatorClass) {
return create(family, id, path, before, configCreatorClass, builder -> {});
}

/**
* Creates and registers a config with fields derived from the fields of the passed class
*
* <p>The passed class should have the following characteristics:
* <ul>
* <li>Has a public no-argument constructor</li>
* <li>Each non-static non-transient field should be final, not null, and be one of the following types:</li>
* <ul>
* <li>A basic type (int, long, float, double, boolean, String, or enum)</li>
* <li>A complex type (a {@link ValueList} or {@link ValueMap} of basic or complex types or a {@link org.quiltmc.config.api.values.ConfigSerializableObject})</li>
* <li>An object whose class follows these rules</li>
* </ul>
* </ul>
*
* <p>Certain annotations can also be used on fields of this class to attach metadata to them. The {@link org.quiltmc.config.api.annotations.Comment}
* annotation is one such annotation that is provided by default, but additional {@link ConfigFieldAnnotationProcessor}s
* can be registered with {@link ConfigFieldAnnotationProcessor#register(Class, ConfigFieldAnnotationProcessor)}.
* Creates and registers a config with a class that contains its WrappedValues as fields.
*
* @param family the mod owning the resulting config file
* @param id the configs id
Expand All @@ -123,140 +97,74 @@ public static <C extends ReflectiveConfig> C create(String family, String id, Pa
* if the path is "client/gui", the config file might be ".minecraft/config/example_mod/client/gui/id.toml"
* @param configCreatorClass a class as described above
* @param after a {@link Config.Creator} that can be used to configure the resulting config further
* @return a {@link WrappedConfig <C>}
* @return a {@link ReflectiveConfig <C>}
*/
public static <C extends ReflectiveConfig> C create(String family, String id, Path path, Class<C> configCreatorClass, Config.Creator after) {
return create(family, id, path, builder -> {}, configCreatorClass, after);
}

/**
* Creates and registers a config with fields derived from the fields of the passed class
*
* <p>The passed class should have the following characteristics:
* <ul>
* <li>Has a public no-argument constructor</li>
* <li>Each non-static non-transient field should be final, not null, and be one of the following types:</li>
* <ul>
* <li>A basic type (int, long, float, double, boolean, String, or enum)</li>
* <li>A complex type (a {@link ValueList} or {@link ValueMap} of basic or complex types or a {@link org.quiltmc.config.api.values.ConfigSerializableObject})</li>
* <li>An object whose class follows these rules</li>
* </ul>
* </ul>
*
* <p>Certain annotations can also be used on fields of this class to attach metadata to them. The {@link org.quiltmc.config.api.annotations.Comment}
* annotation is one such annotation that is provided by default, but additional {@link ConfigFieldAnnotationProcessor}s
* can be registered with {@link ConfigFieldAnnotationProcessor#register(Class, ConfigFieldAnnotationProcessor)}.
* Creates and registers a config with a class that contains its WrappedValues as fields.
*
* @param family the mod owning the resulting config file
* @param id the config's id
* @param path additional path elements to include as part of this configs file, e.g.
* if the path is empty, the config file might be ".minecraft/config/example_mod/id.toml"
* if the path is "client/gui", the config file might be ".minecraft/config/example_mod/client/gui/id.toml"
* @param configCreatorClass a class as described above
* @return a {@link WrappedConfig <C>}
* @return a {@link ReflectiveConfig <C>}
*/
public static <C extends ReflectiveConfig> C create(String family, String id, Path path, Class<C> configCreatorClass) {
return create(family, id, path, builder -> {}, configCreatorClass, builder -> {});
}

/**
* Creates and registers a config with fields derived from the fields of the passed class
*
* <p>The passed class should have the following characteristics:
* <ul>
* <li>Has a public no-argument constructor</li>
* <li>Each non-static non-transient field should be final, not null, and be one of the following types:</li>
* <ul>
* <li>A basic type (int, long, float, double, boolean, String, or enum)</li>
* <li>A complex type (a {@link ValueList} or {@link ValueMap} of basic or complex types or a {@link org.quiltmc.config.api.values.ConfigSerializableObject})</li>
* <li>An object whose class follows these rules</li>
* </ul>
* </ul>
*
* <p>Certain annotations can also be used on fields of this class to attach metadata to them. The {@link org.quiltmc.config.api.annotations.Comment}
* annotation is one such annotation that is provided by default, but additional {@link ConfigFieldAnnotationProcessor}s
* can be registered with {@link ConfigFieldAnnotationProcessor#register(Class, ConfigFieldAnnotationProcessor)}.
* Creates and registers a config with a class that contains its WrappedValues as fields.
*
* @param family the mod owning the resulting config file
* @param id the config's id
* @param before a {@link Config.Creator} that can be used to configure the resulting config further
* @param configCreatorClass a class as described above
* @param after a {@link Config.Creator} that can be used to configure the resulting config further
* @return a {@link WrappedConfig <C>}
* @return a {@link ReflectiveConfig <C>}
*/
public static <C extends ReflectiveConfig> C create(String family, String id, Config.Creator before, Class<C> configCreatorClass, Config.Creator after) {
return create(family, id, Paths.get(""), before, configCreatorClass, after);
}

/**
* Creates and registers a config with fields derived from the fields of the passed class
*
* <p>The passed class should have the following characteristics:
* <ul>
* <li>Has a public no-argument constructor</li>
* <li>Each non-static non-transient field should be final, not null, and be one of the following types:</li>
* <ul>
* <li>A basic type (int, long, float, double, boolean, String, or enum)</li>
* <li>A complex type (a {@link ValueList} or {@link ValueMap} of basic or complex types or a {@link org.quiltmc.config.api.values.ConfigSerializableObject})</li>
* <li>An object whose class follows these rules</li>
* </ul>
* </ul>
*
* <p>Certain annotations can also be used on fields of this class to attach metadata to them. The {@link org.quiltmc.config.api.annotations.Comment}
* annotation is one such annotation that is provided by default, but additional {@link ConfigFieldAnnotationProcessor}s
* can be registered with {@link ConfigFieldAnnotationProcessor#register(Class, ConfigFieldAnnotationProcessor)}.
* Creates and registers a config with a class that contains its WrappedValues as fields.
*
* @param family the mod owning the resulting config file
* @param id the config's id
* @param before a {@link Config.Creator} that can be used to configure the resulting config further
* @param configCreatorClass a class as described above
* @return a {@link WrappedConfig <C>}
* @return a {@link ReflectiveConfig <C>}
*/
public static <C extends ReflectiveConfig> C create(String family, String id, Config.Creator before, Class<C> configCreatorClass) {
return create(family, id, Paths.get(""), before, configCreatorClass, builder -> {});
}

/**
* Creates and registers a config with fields derived from the fields of the passed class
*
* <p>The passed class should have the following characteristics:
* <ul>
* <li>Has a public no-argument constructor</li>
* <li>Each non-static non-transient field should be final, not null, and be one of the following types:</li>
* <ul>
* <li>A basic type (int, long, float, double, boolean, String, or enum)</li>
* <li>A complex type (a {@link ValueList} or {@link ValueMap} of basic or complex types or a {@link org.quiltmc.config.api.values.ConfigSerializableObject})</li>
* <li>An object whose class follows these rules</li>
* </ul>
* </ul>
*
* <p>Certain annotations can also be used on fields of this class to attach metadata to them. The {@link org.quiltmc.config.api.annotations.Comment}
* annotation is one such annotation that is provided by default, but additional {@link ConfigFieldAnnotationProcessor}s
* can be registered with {@link ConfigFieldAnnotationProcessor#register(Class, ConfigFieldAnnotationProcessor)}.
* Creates and registers a config with a class that contains its WrappedValues as fields.
*
* @param family the mod owning the resulting config file
* @param id the config's id
* @param configCreatorClass a class as described above
* @param after a {@link Config.Creator} that can be used to configure the resulting config further
* @return a {@link WrappedConfig <C>}
* @return a {@link ReflectiveConfig <C>}
*/
public static <C extends ReflectiveConfig> C create(String family, String id, Class<C> configCreatorClass, Config.Creator after) {
return create(family, id, Paths.get(""), builder -> {}, configCreatorClass, after);
}

/**
* Creates and registers a config with fields derived from the fields of the passed class
*
* <p>The passed class should have the following characteristics:
* <ul>
* <li>Has a public no-argument constructor</li>
* <li>Each non-static field should be a final field initialized from the helper methods in{@link ReflectiveConfig}</li>
* </ul>
*
* Creates and registers a config with a class that contains its WrappedValues as fields.
*
* @param family the mod owning the resulting config file
* @param id the config's id
* @param configCreatorClass a class as described above
* @return a {@link WrappedConfig <C>}
* @return a {@link ReflectiveConfig <C>}
*/
public static <C extends ReflectiveConfig> C create(String family, String id, Class<C> configCreatorClass) {
return create(family, id, Paths.get(""), builder -> {}, configCreatorClass, builder -> {});
Expand Down

0 comments on commit caf106b

Please sign in to comment.