From: David ‘Bombe’ Roden Date: Sat, 25 Jun 2016 20:24:34 +0000 (+0200) Subject: Clean up parser interface X-Git-Tag: 0.9.5^2~19 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=16b7ecd68873178d79b81023fc702d61d7696e13;p=Sone.git Clean up parser interface --- diff --git a/src/main/java/net/pterodactylus/sone/text/Parser.java b/src/main/java/net/pterodactylus/sone/text/Parser.java index 531efa7..ca26a79 100644 --- a/src/main/java/net/pterodactylus/sone/text/Parser.java +++ b/src/main/java/net/pterodactylus/sone/text/Parser.java @@ -19,6 +19,8 @@ package net.pterodactylus.sone.text; import java.io.IOException; import java.io.Reader; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * Interface for parsers that can create {@link Part}s from a text source @@ -39,6 +41,7 @@ public interface Parser { * The text source * @return The parsed parts */ - public Iterable parse(C context, String source); + @Nonnull + Iterable parse(@Nullable C context, @Nonnull String source); } diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index 18dd53f..ae299e1 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -28,6 +28,9 @@ import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import net.pterodactylus.sone.data.Post; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.data.impl.IdOnlySone; @@ -117,8 +120,9 @@ public class SoneTextParser implements Parser { /** * {@inheritDoc} */ + @Nonnull @Override - public Iterable parse(SoneTextParserContext context, String source) { + public Iterable parse(@Nullable SoneTextParserContext context, @Nonnull String source) { PartContainer parts = new PartContainer(); BufferedReader bufferedReader = new BufferedReader(new StringReader(source)); try {