Make some fields final

This commit is contained in:
Coffeemakr 2017-11-30 11:34:26 +01:00
parent 89f8678912
commit 58df281975
No known key found for this signature in database
GPG key ID: 3F35676D8FF6E743
13 changed files with 22 additions and 21 deletions

View file

@ -16,7 +16,7 @@ public abstract class Info implements Serializable {
public final String url; public final String url;
public final String name; public final String name;
public List<Throwable> errors = new ArrayList<>(); public final List<Throwable> errors = new ArrayList<>();
public void addError(Throwable throwable) { public void addError(Throwable throwable) {
this.errors.add(throwable); this.errors.add(throwable);

View file

@ -3,9 +3,10 @@ package org.schabi.newpipe.extractor;
import org.schabi.newpipe.extractor.stream.SubtitlesFormat; import org.schabi.newpipe.extractor.stream.SubtitlesFormat;
public class Subtitles { public class Subtitles {
private SubtitlesFormat format; private final SubtitlesFormat format;
private String languageCode, URL; private final String languageCode;
private boolean autoGenerated; private final String URL;
private final boolean autoGenerated;
public Subtitles(SubtitlesFormat format, String languageCode, String URL, boolean autoGenerated) { public Subtitles(SubtitlesFormat format, String languageCode, String URL, boolean autoGenerated) {
this.format = format; this.format = format;

View file

@ -27,7 +27,7 @@ import java.util.List;
public abstract class SuggestionExtractor { public abstract class SuggestionExtractor {
private int serviceId; private final int serviceId;
public SuggestionExtractor(int serviceId) { public SuggestionExtractor(int serviceId) {
this.serviceId = serviceId; this.serviceId = serviceId;

View file

@ -30,7 +30,7 @@ import java.io.IOException;
public abstract class KioskExtractor extends ListExtractor { public abstract class KioskExtractor extends ListExtractor {
private String contentCountry = null; private String contentCountry = null;
private String id = null; private final String id;
public KioskExtractor(StreamingService streamingService, public KioskExtractor(StreamingService streamingService,
String url, String url,

View file

@ -19,8 +19,8 @@ public class KioskList {
throws ExtractionException, IOException; throws ExtractionException, IOException;
} }
private int service_id; private final int service_id;
private HashMap<String, KioskEntry> kioskList = new HashMap<>(); private final HashMap<String, KioskEntry> kioskList = new HashMap<>();
private String defaultKiosk = null; private String defaultKiosk = null;
private class KioskEntry { private class KioskEntry {
@ -28,8 +28,8 @@ public class KioskList {
extractorFactory = ef; extractorFactory = ef;
handler = h; handler = h;
} }
KioskExtractorFactory extractorFactory; final KioskExtractorFactory extractorFactory;
UrlIdHandler handler; final UrlIdHandler handler;
} }
public KioskList(int service_id) { public KioskList(int service_id) {

View file

@ -35,7 +35,7 @@ public abstract class SearchEngine {
} }
} }
private InfoItemSearchCollector collector; private final InfoItemSearchCollector collector;
public SearchEngine(int serviceId) { public SearchEngine(int serviceId) {
collector = new InfoItemSearchCollector(serviceId); collector = new InfoItemSearchCollector(serviceId);

View file

@ -4,7 +4,7 @@ import com.grack.nanojson.JsonObject;
import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor; import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor;
public class SoundcloudChannelInfoItemExtractor implements ChannelInfoItemExtractor { public class SoundcloudChannelInfoItemExtractor implements ChannelInfoItemExtractor {
private JsonObject searchResult; private final JsonObject searchResult;
public SoundcloudChannelInfoItemExtractor(JsonObject searchResult) { public SoundcloudChannelInfoItemExtractor(JsonObject searchResult) {
this.searchResult = searchResult; this.searchResult = searchResult;

View file

@ -9,7 +9,7 @@ public class SoundcloudPlaylistInfoItemExtractor implements PlaylistInfoItemExtr
private static final String AVATAR_URL_KEY = "avatar_url"; private static final String AVATAR_URL_KEY = "avatar_url";
private static final String ARTWORK_URL_KEY = "artwork_url"; private static final String ARTWORK_URL_KEY = "artwork_url";
private JsonObject searchResult; private final JsonObject searchResult;
public SoundcloudPlaylistInfoItemExtractor(JsonObject searchResult) { public SoundcloudPlaylistInfoItemExtractor(JsonObject searchResult) {
this.searchResult = searchResult; this.searchResult = searchResult;

View file

@ -146,8 +146,8 @@ public class ItagItem {
return mediaFormat; return mediaFormat;
} }
public int id; public final int id;
public ItagType itagType; public final ItagType itagType;
// Audio fields // Audio fields
public int avgBitrate = -1; public int avgBitrate = -1;

View file

@ -26,7 +26,7 @@ import org.schabi.newpipe.extractor.utils.Utils;
*/ */
public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor { public class YoutubeChannelInfoItemExtractor implements ChannelInfoItemExtractor {
private Element el; private final Element el;
public YoutubeChannelInfoItemExtractor(Element el) { public YoutubeChannelInfoItemExtractor(Element el) {
this.el = el; this.el = el;

View file

@ -6,7 +6,7 @@ import org.schabi.newpipe.extractor.playlist.PlaylistInfoItemExtractor;
import org.schabi.newpipe.extractor.utils.Utils; import org.schabi.newpipe.extractor.utils.Utils;
public class YoutubePlaylistInfoItemExtractor implements PlaylistInfoItemExtractor { public class YoutubePlaylistInfoItemExtractor implements PlaylistInfoItemExtractor {
private Element el; private final Element el;
public YoutubePlaylistInfoItemExtractor(Element el) { public YoutubePlaylistInfoItemExtractor(Element el) {
this.el = el; this.el = el;

View file

@ -13,8 +13,8 @@ public enum SubtitlesFormat {
TRANSCRIPT2 (0x3, "srv2"), TRANSCRIPT2 (0x3, "srv2"),
TRANSCRIPT3 (0x4, "srv3"); TRANSCRIPT3 (0x4, "srv3");
private int id; private final int id;
private String extension; private final String extension;
SubtitlesFormat(int id, String extension) { SubtitlesFormat(int id, String extension) {
this.id = id; this.id = id;

View file

@ -23,8 +23,8 @@ package org.schabi.newpipe.extractor.stream;
import org.schabi.newpipe.extractor.MediaFormat; import org.schabi.newpipe.extractor.MediaFormat;
public class VideoStream extends Stream { public class VideoStream extends Stream {
public String resolution; public final String resolution;
public boolean isVideoOnly; public final boolean isVideoOnly;
public VideoStream(String url, MediaFormat format, String resolution) { public VideoStream(String url, MediaFormat format, String resolution) {