package net.pterodactylus.sone.main;
import java.io.File;
+import javax.annotation.Nonnull;
import net.pterodactylus.sone.template.FilesystemTemplate;
import net.pterodactylus.sone.web.pages.ReloadingPage;
this.filesystemPath = filesystemPath;
}
+ @Nonnull
@Override
- public Template loadTemplate(String path) {
+ public Template loadTemplate(@Nonnull String path) {
return new FilesystemTemplate(new File(filesystemPath, path).getAbsolutePath());
}
+ @Nonnull
@Override
- public <REQ extends Request> Page<REQ> loadStaticPage(String basePath, String prefix, String mimeType) {
+ public <REQ extends Request> Page<REQ> loadStaticPage(@Nonnull String basePath, @Nonnull String prefix, @Nonnull String mimeType) {
return new ReloadingPage<>(basePath, new File(filesystemPath, prefix).getAbsolutePath(), mimeType);
}
+ @Nonnull
@Override
public TemplateProvider getTemplateProvider() {
return new FilesystemTemplateProvider(new File(filesystemPath, "/templates/").getAbsolutePath());
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
+import javax.annotation.Nonnull;
import net.pterodactylus.sone.web.WebInterface;
import net.pterodactylus.util.io.Closer;
*/
public class DefaultLoaders implements Loaders {
+ @Nonnull
@Override
- public Template loadTemplate(String path) {
+ public Template loadTemplate(@Nonnull String path) {
InputStream templateInputStream = null;
Reader reader = null;
try {
}
}
+ @Nonnull
@Override
- public <REQ extends Request> Page<REQ> loadStaticPage(String pathPrefix, String basePath, String mimeType) {
+ public <REQ extends Request> Page<REQ> loadStaticPage(@Nonnull String pathPrefix, @Nonnull String basePath, @Nonnull String mimeType) {
return new StaticPage<REQ>(pathPrefix, basePath, mimeType) {
};
}
+ @Nonnull
@Override
public TemplateProvider getTemplateProvider() {
return new ClassPathTemplateProvider(WebInterface.class, "/templates/");
package net.pterodactylus.sone.main;
+import javax.annotation.Nonnull;
+
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateProvider;
import net.pterodactylus.util.web.Page;
@ImplementedBy(DefaultLoaders.class)
public interface Loaders {
- Template loadTemplate(String path);
- <REQ extends Request> Page<REQ> loadStaticPage(String basePath, String prefix, String mimeType);
- TemplateProvider getTemplateProvider();
+ @Nonnull Template loadTemplate(@Nonnull String path);
+ @Nonnull <REQ extends Request> Page<REQ> loadStaticPage(@Nonnull String basePath, @Nonnull String prefix, @Nonnull String mimeType);
+ @Nonnull TemplateProvider getTemplateProvider();
}