Add @Nonnull annotations

This commit is contained in:
Coffeemakr 2017-11-25 02:03:30 +01:00
parent d0a05706e3
commit d4b72f539b
No known key found for this signature in database
GPG Key ID: 3F35676D8FF6E743
10 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package org.schabi.newpipe.extractor;
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.stream.StreamInfoItemCollector;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.List;
@ -39,7 +40,9 @@ public abstract class ListExtractor extends Extractor {
return nextStreamsUrl == null || nextStreamsUrl.isEmpty();
}
@Nonnull
public abstract StreamInfoItemCollector getStreams() throws IOException, ExtractionException;
public abstract NextItemsResult getNextStreams() throws IOException, ExtractionException;
public boolean hasMoreStreams() {

View File

@ -86,6 +86,7 @@ public class SoundcloudChannelExtractor extends ChannelExtractor {
return user.getString("description", "");
}
@Nonnull
@Override
public StreamInfoItemCollector getStreams() throws IOException, ExtractionException {
StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId());

View File

@ -50,6 +50,7 @@ public class SoundcloudChartsExtractor extends KioskExtractor {
return new NextItemsResult(collector, nextStreamsUrl);
}
@Nonnull
@Override
public StreamInfoItemCollector getStreams() throws IOException, ExtractionException {
StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId());

View File

@ -88,6 +88,7 @@ public class SoundcloudPlaylistExtractor extends PlaylistExtractor {
return playlist.getNumber("track_count", 0).longValue();
}
@Nonnull
@Override
public StreamInfoItemCollector getStreams() throws IOException, ExtractionException {
StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId());

View File

@ -71,7 +71,7 @@ public class SoundcloudStreamExtractor extends StreamExtractor {
@Override
public int getAgeLimit() {
return 0;
return NO_AGE_LIMIT;
}
@Override

View File

@ -163,6 +163,7 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
}
}
@Nonnull
@Override
public StreamInfoItemCollector getStreams() throws IOException, ExtractionException {
StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId());

View File

@ -143,6 +143,7 @@ public class YoutubePlaylistExtractor extends PlaylistExtractor {
}
}
@Nonnull
@Override
public StreamInfoItemCollector getStreams() throws IOException, ExtractionException {
StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId());

View File

@ -167,7 +167,7 @@ public class YoutubeStreamExtractor extends StreamExtractor {
@Override
public int getAgeLimit() throws ParsingException {
if (!isAgeRestricted) {
return 0;
return NO_AGE_LIMIT;
}
try {
return Integer.valueOf(doc.select("meta[property=\"og:restrictions:age\"]")

View File

@ -79,6 +79,7 @@ public class YoutubeTrendingExtractor extends KioskExtractor {
}
}
@Nonnull
@Override
public StreamInfoItemCollector getStreams() throws ParsingException {
StreamInfoItemCollector collector = new StreamInfoItemCollector(getServiceId());

View File

@ -39,6 +39,8 @@ import java.util.List;
*/
public abstract class StreamExtractor extends Extractor {
public static final int NO_AGE_LIMIT = 0;
public StreamExtractor(StreamingService service, String url) throws IOException, ExtractionException {
super(service, url);
}