Class SourceSet


  • public final class SourceSet
    extends java.lang.Object
    Represents an image source set. See https://html.spec.whatwg.org/#source-set
    • Field Detail

      • LIST_TO_URL_FUNC

        private static final com.google.common.base.Function<SourceSet.ImageSource,​java.lang.String> LIST_TO_URL_FUNC
      • urls

        private final java.util.List<java.lang.String> urls
      • size

        private final java.lang.String size
    • Constructor Detail

      • SourceSet

        private SourceSet​(java.util.List<SourceSet.ImageSource> sources,
                          java.lang.String size)
    • Method Detail

      • parse

        public static SourceSet parse​(java.lang.String srcset)
        Parses a `srcset` value and swallows the errors. See https://html.spec.whatwg.org/#parsing-a-srcset-attribute
      • getImageSources

        public java.util.List<SourceSet.ImageSource> getImageSources()
        Returns:
        the list of image sources in the source set.
      • getImageURLs

        public java.util.List<java.lang.String> getImageURLs()
        Returns:
        the list of the URLs of the images sources in the source set.
      • getSourceSize

        public java.lang.String getSourceSize()
        Returns:
        the number of sources in this source set.
      • isEmpty

        public boolean isEmpty()
        Returns:
        whether this source set is empty.