-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
LocalizationMapReader.java
43 lines (38 loc) · 1.55 KB
/
LocalizationMapReader.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.freya02.botcommands.api.localization.readers;
import com.freya02.botcommands.api.core.config.BServiceConfigBuilder;
import com.freya02.botcommands.api.core.service.annotations.BService;
import com.freya02.botcommands.api.core.service.annotations.InterfacedService;
import com.freya02.botcommands.api.localization.LocalizationMap;
import com.freya02.botcommands.api.localization.LocalizationMapRequest;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
/**
* Reads localization mappings
*
* <p>
* <b>Usage</b>: Register your instance as a service with {@link BService}
* or {@link BServiceConfigBuilder#getServiceAnnotations() any annotation that enables your class for dependency injection}.
*/
@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
*/
default String appendPath(String path, 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.
*
* <p>This should not read parent bundles, only this specific one.
*/
@Nullable
LocalizationMap readLocalizationMap(@NotNull LocalizationMapRequest request) throws IOException;
}