예제 #1
0
  @Override
  public VideoTo map(Map<XmlNodeName, String> trackValues) {
    if (!canMap(trackValues)) {
      throw new CannotMapTrackValuesException(this, trackValues);
    }

    Date dateAdded = extractor.extractDate(trackValues, XmlNodeName.DATE_ADDED);
    Date dateModified = extractor.extractDate(trackValues, XmlNodeName.DATE_MODIFIED);
    String album = extractor.extractString(trackValues, XmlNodeName.ALBUM);
    String albumArtist = extractor.extractString(trackValues, XmlNodeName.ALBUM_ARTIST);
    String artist = extractor.extractString(trackValues, XmlNodeName.ARTIST);
    String genre = extractor.extractString(trackValues, XmlNodeName.GENRE);
    String name = extractor.extractString(trackValues, XmlNodeName.NAME);
    RatingTo rating = extractor.extractRating(trackValues, XmlNodeName.RATING);
    int playCount = extractor.extractInt(trackValues, XmlNodeName.PLAY_COUNT);
    int year = extractor.extractInt(trackValues, XmlNodeName.YEAR);
    boolean hasVideo = extractor.extractBoolean(trackValues, XmlNodeName.HAS_VIDEO);
    int videoHeight = extractor.extractInt(trackValues, XmlNodeName.VIDEO_HEIGHT);
    int videoWidth = extractor.extractInt(trackValues, XmlNodeName.VIDEO_WIDTH);
    boolean hd = extractor.extractBoolean(trackValues, XmlNodeName.HD);

    return new VideoTo(
        name,
        album,
        albumArtist,
        artist,
        year,
        genre,
        dateAdded,
        dateModified,
        rating,
        playCount,
        hasVideo,
        videoHeight,
        videoWidth,
        hd);
  }