2 * Copyright (c) 2015. Developed by Hedgecode.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.hedgecode.xml.xspf;
19 import java.util.ArrayList;
20 import java.util.List;
25 * @author Dmitry Samoshin aka gotty
27 public final class XSPFTrack implements Track {
29 protected XSPFTrack() {
35 private List<String> locations = new ArrayList<>();
40 private List<String> identifiers = new ArrayList<>();
50 private String creator;
55 private String annotation;
75 private Integer trackNum;
80 private Integer duration;
85 private List<Link> links = new ArrayList<>();
90 private List<Meta> metas = new ArrayList<>();
95 private List<Extension> extensions = new ArrayList<>();
98 public List<String> getLocations() {
103 public void addLocation(String location) {
104 locations.add(location);
108 public List<String> getIdentifiers() {
113 public void addIdentifier(String identifier) {
114 identifiers.add(identifier);
118 public String getTitle() {
123 public void setTitle(String title) {
128 public String getCreator() {
133 public void setCreator(String creator) {
134 this.creator = creator;
138 public String getAnnotation() {
143 public void setAnnotation(String annotation) {
144 this.annotation = annotation;
148 public String getInfo() {
153 public void setInfo(String info) {
158 public String getImage() {
163 public void setImage(String image) {
168 public String getAlbum() {
173 public void setAlbum(String album) {
178 public Integer getTrackNum() {
183 public void setTrackNum(Integer trackNum) {
184 this.trackNum = trackNum;
188 public Integer getDuration() {
193 public void setDuration(Integer duration) {
194 this.duration = duration;
198 public List<Link> getLinks() {
203 public void addLink(Link link) {
208 public List<Meta> getMetas() {
213 public void addMeta(Meta meta) {
218 public List<Extension> getExtensions() {
223 public void addExtension(Extension extension) {
224 extensions.add(extension);
227 protected void bind(XMLBindTrack bindTrack) {
228 for (String location : locations)
229 bindTrack.addLocation(location);
230 for (String identifier : identifiers)
231 bindTrack.addIdentifier(identifier);
232 bindTrack.setTitle(title);
233 bindTrack.setCreator(creator);
234 bindTrack.setAnnotation(annotation);
235 bindTrack.setInfo(info);
236 bindTrack.setImage(image);
237 bindTrack.setAlbum(album);
238 bindTrack.setTrackNum(trackNum);
239 bindTrack.setDuration(duration);
240 for (Link link : links)
241 bindTrack.addLink(link);
242 for (Meta meta :metas)
243 bindTrack.addMeta(meta);
244 for (Extension extension : extensions)
245 bindTrack.addExtension(extension);
248 protected void unbind(XMLBindTrack bindTrack) {
249 locations = bindTrack.getLocations();
250 identifiers = bindTrack.getIdentifiers();
251 title = bindTrack.getTitle();
252 creator = bindTrack.getCreator();
253 annotation = bindTrack.getAnnotation();
254 info = bindTrack.getInfo();
255 image = bindTrack.getImage();
256 album = bindTrack.getAlbum();
257 trackNum = bindTrack.getTrackNum();
258 duration = bindTrack.getDuration();
259 links = bindTrack.getLinks();
260 metas = bindTrack.getMetas();
261 extensions = bindTrack.getExtensions();