Skip to content

Commit

Permalink
javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
AshlyneS committed Aug 21, 2023
1 parent 04b700b commit 64c0b9b
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 7 deletions.
15 changes: 15 additions & 0 deletions src/net/foxgenesis/database/AbstractDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ synchronized final void unload() {

/**
* NEED_JAVADOC
*
* @return Returns the new {@link Connection}
*
* @throws SQLException
*/
Expand All @@ -109,6 +111,7 @@ protected Connection openConnection() throws SQLException {
*
* @param id
* @param func
* @param flags
*
* @throws SQLException
*/
Expand Down Expand Up @@ -146,6 +149,10 @@ protected void prepareCallable(String id, SQLConsumer<CallableStatement> func) t
* @param <U>
* @param id
* @param func
* @param flags
*
* @return Returns the result of {@code func} otherwise an empty
* {@link Optional}
*
* @throws SQLException
*/
Expand All @@ -167,6 +174,9 @@ protected <U> Optional<U> mapStatement(String id, SQLFunction<PreparedStatement,
* @param <U>
* @param id
* @param func
*
* @return Returns the result of {@code func} otherwise an empty
* {@link Optional}
*
* @throws SQLException
*/
Expand All @@ -185,6 +195,9 @@ protected <U> Optional<U> mapCallable(String id, SQLFunction<CallableStatement,
* NEED_JAVADOC
*
* @param id
*
* @return Returns {@code true} if the statement is registered. {@code false}
* otherwise
*/
protected final boolean hasStatementID(String id) {
return statements.containsKey(id);
Expand All @@ -194,6 +207,8 @@ protected final boolean hasStatementID(String id) {
* NEED_JAVADOC
*
* @param id
*
* @return Returns the raw SQL statement
*/
protected final String getRawStatement(String id) {
if (!hasStatementID(id))
Expand Down
5 changes: 5 additions & 0 deletions src/net/foxgenesis/property/Property.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ default void checkUserInput(boolean user) {
* @return Returns the serialized data
*/
static byte[] serialize(@NotNull PropertyInfo info, @NotNull Serializable obj) {
// PLAIN TEXT
if (info.type() == PropertyType.PLAIN) {
if (obj.getClass().isArray()) {
Serializable[] a = (Serializable[]) obj;
Expand All @@ -112,6 +113,8 @@ static byte[] serialize(@NotNull PropertyInfo info, @NotNull Serializable obj) {

return obj.toString().getBytes();
}

// NUMBERS
if (info.type() == PropertyType.NUMBER) {
if (obj instanceof Integer i)
return ByteBuffer.allocate(Integer.SIZE / Byte.SIZE).putInt(i).array();
Expand All @@ -128,6 +131,8 @@ else if (obj instanceof Boolean f)
else if (obj instanceof Byte b)
return new byte[] { b };
}

// JAVA OBJECTS
return SerializationUtils.serialize(obj);
}
}
2 changes: 2 additions & 0 deletions src/net/foxgenesis/property/PropertyProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*
* @param <C> property category type
* @param <K> property key type
* @param <G> lookup type
* @param <M> property mapping type
*
* @author Ashley
*/
Expand Down
4 changes: 4 additions & 0 deletions src/net/foxgenesis/util/function/QuadFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*
* @param <T> the type of the first argument to the function
* @param <U> the type of the second argument to the function
* @param <V>
* @param <W>
* @param <R> the type of the result of the function
*
* @see Function
Expand All @@ -25,6 +27,8 @@ public interface QuadFunction<T, U, V, W, R> {
*
* @param t the first function argument
* @param u the second function argument
* @param v
* @param w
* @return the function result
*/
R apply(T t, U u, V v, W w);
Expand Down
2 changes: 2 additions & 0 deletions src/net/foxgenesis/watame/WatameBotSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ String getPBToken() {

/**
* NEED_JAVADOC
*
* @param filepath
*
* @return Returns the read token
*
Expand Down
15 changes: 8 additions & 7 deletions src/net/foxgenesis/watame/plugin/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@

/**
* A service providing functionality to {@link WatameBot}.
* <p>
* Providers should provide a <b>no-argument constructor</b> or a
* {@code public static Plugin provider()} method in accordance to
* {@link java.util.ServiceLoader.Provider#get() Provider.get()}
* </p>
*
* @author Ashley
*
* @implSpec Providers should provide a <b>no-argument constructor</b> or a
* {@code public static Plugin provider()} method in accordance to
* {@link java.util.ServiceLoader.Provider#get() Provider.get()}
*
*/
public abstract class Plugin {
Expand Down Expand Up @@ -100,13 +101,13 @@ public abstract class Plugin {
* ServiceLoader} to load and initialize required plugin data.
* <p>
* Types of plugin data would include:
* </p>
* <ul>
* <li>Configuration settings</li>
* <li>Constants</li>
* </ul>
* Anything beyond the previous should be loaded in the {@link #preInit()}
* method.
* </p>
*
* @throws SeverePluginException if the plugin is not in a named module or there
* was a problem while loading the
Expand Down Expand Up @@ -271,8 +272,8 @@ protected final PluginProperty getProperty(String name) {
* Get the provider for registering and getting {@link PluginProperty
* PluginProperties}.
*
* @return Returns the {@link PluginPropertyProvider} used by {@link Plugin Plugins} to
* register plugin properties
* @return Returns the {@link PluginPropertyProvider} used by {@link Plugin
* Plugins} to register plugin properties
*/
protected final PluginPropertyProvider getPropertyProvider() {
return WatameBot.INSTANCE.getPropertyProvider();
Expand Down
1 change: 1 addition & 0 deletions src/net/foxgenesis/watame/plugin/PluginHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class PluginHandler<@NotNull T extends Plugin> implements Closeable {
* Construct a new {@link PluginHandler} with the specified {@link ModuleLayer}
* and plugin {@link Class}.
*
* @param context - instance context
* @param layer - layer the {@link ServiceLoader} should use
* @param pluginClass - the plugin {@link Class} to load
*/
Expand Down

0 comments on commit 64c0b9b

Please sign in to comment.