Package Torello.REST

Class YouTube.VideoSummary

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing class:
    YouTube

    public static class YouTube.VideoSummary
    extends java.lang.Object
    implements java.io.Serializable
    YouTube.VideoSummary Documentation.

    This is a small "Return Result" class. Whenever a user performs a video search for videos on YouTube, the results that are returned include "Thumbnail Images" for that video. The thumbnail image information is encapsulated in this class.
    See Also:
    Serialized Form



    • Field Detail

      • serialVersionUID

        protected static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
        1
        protected static final long serialVersionUID = 1;
        
      • id

        public final java.lang.String id
        The YouTube Video-File ID.
        Code:
        Exact Field Declaration Expression:
        1
        public final String id;
        
      • title

        public final java.lang.String title
        The YouTube Video-Title.
        Code:
        Exact Field Declaration Expression:
        1
        public final String title;
        
      • descSnippet

        public final java.lang.String descSnippet
        The abbreviated description of the video.
        Code:
        Exact Field Declaration Expression:
        1
        public final String descSnippet;
        
      • datePublished

        public final java.util.Date datePublished
        The date & time when this video-file was uploaded.
        Code:
        Exact Field Declaration Expression:
        1
        public final Date datePublished;
        
      • eTag

        public final java.lang.String eTag
        The etag that was returned with this VideoSummary
        Code:
        Exact Field Declaration Expression:
        1
        public final String eTag;
        
      • thumbnails

        protected final java.util.TreeMap<java.lang.String,​YouTube.Thumbnail> thumbnails
        The thumbnail images that may be used for this video when proving links.
        Code:
        Exact Field Declaration Expression:
        1
        protected final TreeMap<String, Thumbnail> thumbnails = new TreeMap<>();
        
    • Constructor Detail

      • VideoSummary

        public VideoSummary​
                    (java.lang.String id,
                     java.lang.String title,
                     java.lang.String descSnippet,
                     java.util.Date datePublished,
                     java.lang.String eTag,
                     java.util.TreeMap<java.lang.String,​YouTube.Thumbnail> thumbnails)
        
    • Method Detail

      • thumbnailIterator

        public java.util.Iterator<YouTube.ThumbnailthumbnailIterator()
        Internally, the list of thumbnail images are stored in a TreeMap<String, Thumbnail>. This requests an Iterator over them.
        Returns:
        An Iterator<Thumbnail> over the thumbnail images in this instance of VideoSummary.
        Code:
        Exact Method Body:
        1
         return thumbnails.values().iterator();
        
      • getThumbnail

        public YouTube.Thumbnail getThumbnail​(java.lang.String thumbnailName)
        Allows a user to request a particular thumbnail image. Common values for thumbnail image names are 'default', 'high', 'medium', etc....
        Parameters:
        thumbnailName - The name of the thumbnail
        Returns:
        A thumbnail image information instance (class 'Thumbnail'), or null if there is no such thumbnail image.
        Code:
        Exact Method Body:
        1
         return thumbnails.get(thumbnailName);
        
      • toString

        public java.lang.String toString()
        This returns a brief summary of 'this' VideoSummary as a java.lang.String
        Overrides:
        toString in class java.lang.Object
        Returns:
        This VideoSummary as a String.

        NOTE: Only the URL of the 'default' thumb-nail image will be appended to the returned String. If this VideoSummary does not have a default thumb-nail image, then a dash is appended. In the case that there are other thumb-nails (regardless of whether there is or is not a default thumb-nail), those image-URL's will not be included inside the String that is returned.
        Code:
        Exact Method Body:
        1
        2
        3
        4
        5
        6
        7
         Thumbnail defaultThumb = thumbnails.get("default");
         return
             "ID                  " + id + '\n' +
             "TITLE:              " + title + '\n' +
             "DESCRIPTION:        " + descSnippet + '\n' +
             "DATE:               " + sdfOut.format(datePublished) + '\n' +
             "DEFAULT THUMB URL:  " + ((defaultThumb == null) ? "-" : defaultThumb.imageURL);