Skip to content

Commit

Permalink
docs: Begin adding javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStegii committed Sep 5, 2023
1 parent 1f9ff36 commit 6ab874b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/src/main/java/io/github/almightysatan/slams/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

import org.jetbrains.annotations.Nullable;

/**
* Provides additional context for language entries.
*/
public interface Context {

@Nullable Language language();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,20 @@
import java.util.Arrays;
import java.util.List;

/**
* {@link MMStringArrayEntry}s represent a {@link String} array in a language file parsed in MiniMessage format.
* They can be used to get a {@link Component} array.
*/
public interface MMStringArrayEntry extends MMLanguageEntry<Component[]> {

/**
* Creates a new {@link MMStringArrayEntry} with the given path, {@link LanguageManager} and {@link ContextTagResolver}.
*
* @param path the path of the entry
* @param languageManager the language manager
* @param tagResolver the tag resolver
* @return the created entry
*/
static @NotNull MMStringArrayEntry of(@NotNull String path, @NotNull LanguageManager languageManager, @Nullable ContextTagResolver<Context> tagResolver) {
class MMStringArrayEntryImpl extends AbstractMMLanguageEntry<String[]> implements MMStringArrayEntry {

Expand All @@ -55,6 +67,12 @@ protected String[] checkType(@Nullable Object value) throws InvalidTypeException
throw new InvalidTypeException();
}

/**
* Returns the value of this entry as a {@link Component} array.
* @param context the context
* @param tagResolver the tag resolver
* @return the value of this entry as a {@link Component} array
*/
@Override
public @NotNull Component @NotNull [] value(@Nullable Context context, @NotNull ContextTagResolver<Context> tagResolver) {
Object value = this.rawValue(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,21 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* {@link MMStringEntry}s represent a {@link String} in a language file parsed in MiniMessage format.
* They can be used to get a {@link Component}.
*/
public interface MMStringEntry extends MMLanguageEntry<Component> {

/**
* Creates a new {@link MMStringEntry} with the given path, {@link LanguageManager} and {@link ContextTagResolver}.
* If
*
* @param path the path of the entry
* @param languageManager the language manager
* @param tagResolver the tag resolver
* @return the created entry
*/
static @NotNull MMStringEntry of(@NotNull String path, @NotNull LanguageManager languageManager, @Nullable ContextTagResolver<Context> tagResolver) {
class MMStringEntryImpl extends AbstractMMLanguageEntry<String> implements MMStringEntry {

Expand All @@ -45,6 +58,12 @@ protected String checkType(@Nullable Object value) throws InvalidTypeException {
return (String) value;
}

/**
* Returns the value of this entry as a {@link Component}.
* @param context the context
* @param tagResolver the tag resolver
* @return the value of this entry as a {@link Component}
*/
@Override
public @NotNull Component value(@Nullable Context context, @NotNull ContextTagResolver<Context> tagResolver) {
String value = this.rawValue(context);
Expand Down

0 comments on commit 6ab874b

Please sign in to comment.