1 /* 2 * This file is part of *** M y C o R e *** 3 * See http://www.mycore.de/ for details. 4 * 5 * MyCoRe is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * MyCoRe is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with MyCoRe. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 package org.mycore.datamodel.common; 19 20 /** 21 * @author Ren\u00E9 Adler (eagle) 22 * 23 */ 24 public enum MCRDataURLEncoding { 25 26 /** 27 * Base64 encoding 28 */ 29 BASE64("base64"), 30 31 /** 32 * URL encoding 33 */ 34 URL(""); 35 36 private final String value; 37 38 MCRDataURLEncoding(final String value) { 39 this.value = value; 40 } 41 42 /** 43 * Returns the data url encoding. 44 * 45 * @return the set data url encoding 46 */ 47 public String value() { 48 return value; 49 } 50 51 /** 52 * Returns the data url encoding from given value. 53 * 54 * @param value the data url encoding 55 * @return the the data url encoding for value 56 */ 57 public static MCRDataURLEncoding fromValue(final String value) { 58 for (MCRDataURLEncoding encodings : MCRDataURLEncoding.values()) { 59 if (encodings.value.equals(value)) { 60 return encodings; 61 } 62 } 63 throw new IllegalArgumentException(value); 64 } 65 }