/* * Copyright (c) 2015. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.hedgecode.xml.xspf; import java.util.List; import org.hedgecode.xml.xspf.bind.TrackBinder; import static org.hedgecode.xml.xspf.XSPFConstants.Format; /** * * * @author Dmitry Samoshin aka gotty */ public final class PlaylistFactory { public static Playlist createPlaylist(Format format) { return new XSPFPlaylist(format); } public static Track createTrack() { return new XSPFTrack(); } public static Track createTrack(TrackBinder trackBinder) { XSPFTrack track = new XSPFTrack(); track.unbind( new XMLBindTrack(trackBinder) ); return track; } public static void bindTrack(Track track, TrackBinder trackBinder) { if (track instanceof XSPFTrack) ((XSPFTrack)track).bind( new XMLBindTrack(trackBinder) ); } public static Attribution createAttribution() { Attribution attribution = new XSPFAttribution(); return attribution; } public static Attribution createAttribution(String identifier, String location) { Attribution attribution = new XSPFAttribution(); attribution.add(identifier, location); return attribution; } public static Link createLink(String rel, String content) { return new XSPFLink(rel, content); } public static Meta createMeta(String rel, String content) { return new XSPFMeta(rel, content); } public static Extension createExtension(String application, List content) { return new XSPFExtension(application, content); } }