NewPipeExtractor/extractor/src/main/java/org/schabi/newpipe/extractor/Info.java

61 lines
1.3 KiB
Java
Raw Normal View History

package org.schabi.newpipe.extractor;
import java.io.Serializable;
2017-08-06 22:20:15 +02:00
import java.util.ArrayList;
2017-11-11 02:55:56 +01:00
import java.util.Collection;
import java.util.List;
public abstract class Info implements Serializable {
private final int serviceId;
/**
* Id of this Info object <br>
* e.g. Youtube: https://www.youtube.com/watch?v=RER5qCTzZ7 &gt; RER5qCTzZ7
*/
private final String id;
private final String url;
private final String name;
private final List<Throwable> errors = new ArrayList<>();
2017-08-11 20:21:49 +02:00
2017-11-11 02:55:56 +01:00
public void addError(Throwable throwable) {
this.errors.add(throwable);
}
public void addAllErrors(Collection<Throwable> errors) {
this.errors.addAll(errors);
}
public Info(int serviceId, String id, String url, String name) {
this.serviceId = serviceId;
2017-11-11 02:55:56 +01:00
this.id = id;
this.url = url;
this.name = name;
}
2017-08-11 20:21:49 +02:00
@Override
public String toString() {
return getClass().getSimpleName() + "[url=\"" + url + "\", name=\"" + name + "\"]";
}
2017-11-11 02:55:56 +01:00
public int getServiceId() {
return serviceId;
2017-11-11 02:55:56 +01:00
}
public String getId() {
return id;
}
public String getUrl() {
return url;
}
public String getName() {
return name;
}
public List<Throwable> getErrors() {
return errors;
}
}