[LIB-4] Output of results to console
[hespiff.git] / src / main / java / org / hedgecode / xml / xspf / bind / BinderFactory.java
1 /*
2  * Copyright (c) 2015-2019. Developed by Hedgecode.
3  *
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
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.hedgecode.xml.xspf.bind;
18
19 import org.hedgecode.xml.xspf.rng.Track;
20 import org.hedgecode.xml.xspf.xsd.TrackType;
21
22 import static org.hedgecode.xml.xspf.XSPFConstants.Format;
23
24 /**
25  * Playlist/Track Binder Factory.
26  *
27  * @author Dmitry Samoshin aka gotty
28  */
29 public final class BinderFactory {
30
31     public static PlaylistBinder createPlaylistBinder() {
32         return getDefaultPlaylistBinder();
33     }
34
35     public static PlaylistBinder createPlaylistBinder(Format format) {
36         switch(format) {
37             case RELAX_NG:
38                 return new RNGPlaylistBinder();
39             case XSD:
40                 return new XSDPlaylistBinder();
41             default:
42                 return getDefaultPlaylistBinder();
43         }
44     }
45
46     public static TrackBinder createTrackBinder() {
47         return getDefaultTrackBinder();
48     }
49
50     public static TrackBinder createTrackBinder(Format format) {
51         switch(format) {
52             case RELAX_NG:
53                 return new RNGTrackBinder();
54             case XSD:
55                 return new XSDTrackBinder();
56             default:
57                 return getDefaultTrackBinder();
58         }
59     }
60
61     public static TrackBinder createTrackBinder(Track track) {
62         return new RNGTrackBinder(track);
63     }
64
65     public static TrackBinder createTrackBinder(TrackType trackType) {
66         return new XSDTrackBinder(trackType);
67     }
68
69     private static PlaylistBinder getDefaultPlaylistBinder() {
70         return new RNGPlaylistBinder();
71     }
72
73     private static TrackBinder getDefaultTrackBinder() {
74         return new RNGTrackBinder();
75     }
76
77 }