X-Git-Url: https://git.hedgecode.org/?p=hespiff.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fhedgecode%2Fxml%2Fxspf%2FPlaylistFactory.java;fp=src%2Fmain%2Fjava%2Forg%2Fhedgecode%2Fxml%2Fxspf%2FPlaylistFactory.java;h=1e74eb21823689e550dde65238a219c6e285b69f;hp=0000000000000000000000000000000000000000;hb=6310cd885e1db660feb7dc222c2e86cccb5c1fce;hpb=13dba5ab997fc65d1da26de66a49b9a930b81f12 diff --git a/src/main/java/org/hedgecode/xml/xspf/PlaylistFactory.java b/src/main/java/org/hedgecode/xml/xspf/PlaylistFactory.java new file mode 100644 index 0000000..1e74eb2 --- /dev/null +++ b/src/main/java/org/hedgecode/xml/xspf/PlaylistFactory.java @@ -0,0 +1,78 @@ +/* + * 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); + } + +}