imageresolver.HtmlDoc Maven / Gradle / Ivy
package imageresolver;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class HtmlDoc {
private final String url;
private final String html;
private final Map> responseHeaders;
public HtmlDoc(String url, String html, Map> responseHeaders) {
this.html = html;
this.url = url;
this.responseHeaders = responseHeaders;
}
public static HtmlDoc fromHtml(String html) {
return new HtmlDoc(null, html, Collections.emptyMap());
}
public static HtmlDoc fromUrl(String url) {
return new HtmlDoc(url, null, Collections.emptyMap());
}
public String url() {
return url;
}
public Optional html() {
return Optional.ofNullable(html);
}
public Map> responseHeaders() {
return Collections.unmodifiableMap(responseHeaders);
}
}