All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.freya022.botcommands.api.localization.readers.LocalizationMapReader Maven / Gradle / Ivy

package io.github.freya022.botcommands.api.localization.readers;

import io.github.freya022.botcommands.api.core.service.annotations.BService;
import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService;
import io.github.freya022.botcommands.api.localization.LocalizationMap;
import io.github.freya022.botcommands.api.localization.LocalizationMapRequest;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.annotation.Nonnull;
import java.io.IOException;

/**
 * Reads a {@link LocalizationMap} from the provided bundle coordinates.
 * 
This is the final step in reading a localization resource. * *

* Usage: Register your instance as a service with {@link BService}. * * @see JacksonLocalizationMapReader * @see InterfacedService @InterfacedService */ @InterfacedService(acceptMultiple = true) public interface LocalizationMapReader { /** * Utility method to append a path component to an existing path, this is simply {@code path + '.' + other}. * * @param path The current path * @param other The other path component * * @return The new path */ @Nonnull default String appendPath(@Nonnull String path, @Nonnull String other) { if (path.isBlank()) return other; return path + '.' + other; } /** * Reads a {@link LocalizationMap} from the requested bundle, returns {@code null} if no localization map exists. * *

This should not read parent bundles, only this specific one. */ @Nullable LocalizationMap readLocalizationMap(@NotNull LocalizationMapRequest request) throws IOException; }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy