/* * 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.nio.charset.Charset; import java.nio.charset.StandardCharsets; import javax.xml.namespace.QName; /** * Store of library constants. * * @author Dmitry Samoshin aka gotty */ public final class XSPFConstants { public static final Charset DEF_CHARSET = StandardCharsets.UTF_8; public static final String XSD_FORMAT = "xsd"; public static final String RNG_FORMAT = "rng"; public static enum Format { XSD ( XSD_FORMAT ), RELAX_NG ( RNG_FORMAT ); private String formatName; Format(String name) { this.formatName = name; } public String getName() { return formatName; } public static Format byName(String formatName) { for (Format format : Format.values()) { if (format.getName().equals(formatName)) return format; } return null; } } public static final String VER_1_0_2 = "1_0.2"; public static final String VER_1_0_7 = "1_0.7"; public static enum Version { V1_2 ( VER_1_0_2 ), V1_7 ( VER_1_0_7 ); private String versionName; Version(String name) { this.versionName = name; } public String getName() { return versionName; } public static Version byName(String versionName) { for (Version version : Version.values()) { if (version.getName().equals(versionName)) return version; } return null; } } public static final String XSPF_VERSION = "1"; public static final QName PLAYLIST_QNAME = new QName("http://xspf.org/ns/0/", "playlist"); public static final String XML_HEADER_NAME = "com.sun.xml.internal.bind.xmlHeaders"; public static final String XML_HEADER_VALUE = ""; public static interface Errors { public static final int NULL_PLAYLIST = 101; public static final int VALIDATE_ERROR = 201; public static final int BINDING_ERROR = 301; public static final int ENCODING_ERROR = 401; } private XSPFConstants() { throw new AssertionError( "No org.hedgecode.xml.xspf.XSPFConstants instances!" ); } }