1 /*
2 * JasperReports - Free Java Reporting Library.
3 * Copyright (C) 2001 - 2019 TIBCO Software Inc. All rights reserved.
4 * http://www.jaspersoft.com
5 *
6 * Unless you have purchased a commercial license agreement from Jaspersoft,
7 * the following license terms apply:
8 *
9 * This program is part of JasperReports.
10 *
11 * JasperReports is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * JasperReports is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
23 */
24 package net.sf.jasperreports.engine.type;
25
26
27 /**
28 * @author Teodor Danciu (teodord@users.sourceforge.net)
29 */
30 public enum ImageTypeEnum implements JREnum
31 {
32 /**
33 * Specifies that the image is of unknown type.
34 */
35 UNKNOWN((byte)0, "Unknown", null, null),
36
37 /**
38 * Specifies that the image is of GIF type.
39 */
40 GIF((byte)1, "GIF", "image/gif", "gif"),
41
42 /**
43 * Specifies that the image is of JPEG type.
44 */
45 JPEG((byte)2, "JPEG", "image/jpeg", "jpg"),
46
47 /**
48 * Specifies that the image is of PNG type.
49 */
50 PNG((byte)3, "PNG", "image/png", "png"),
51
52 /**
53 * Specifies that the image is of TIFF type.
54 */
55 TIFF((byte)3, "TIFF", "image/tiff", "tiff");
56
57 /**
58 *
59 */
60 private final transient byte value;
61 private final transient String name;
62 private final transient String mimeType;
63 private final transient String fileExtension;
64
65 private ImageTypeEnum(
66 byte value,
67 String name,
68 String mimeType,
69 String fileExtension
70 )
71 {
72 this.value = value;
73 this.name = name;
74 this.mimeType = mimeType;
75 this.fileExtension = fileExtension;
76 }
77
78 /**
79 * @deprecated Used only by deprecated serialized fields.
80 */
81 @Override
82 public Byte getValueByte()
83 {
84 return value;
85 }
86
87 /**
88 * @deprecated Used only by deprecated serialized fields.
89 */
90 @Override
91 public final byte getValue()
92 {
93 return value;
94 }
95
96 @Override
97 public String getName()
98 {
99 return name;
100 }
101
102 /**
103 *
104 */
105 public String getMimeType()
106 {
107 return mimeType;
108 }
109
110 /**
111 *
112 */
113 public String getFileExtension()
114 {
115 return fileExtension;
116 }
117
118 /**
119 *
120 */
121 public static ImageTypeEnum getByName(String name)
122 {
123 return EnumUtil.getEnumByName(values(), name);
124 }
125
126 /**
127 * @deprecated Used only by deprecated serialized fields.
128 */
129 public static ImageTypeEnum getByValue(Byte value)
130 {
131 return (ImageTypeEnum)EnumUtil.getByValue(values(), value);
132 }
133
134 /**
135 * @deprecated Used only by deprecated serialized fields.
136 */
137 public static ImageTypeEnum getByValue(byte value)
138 {
139 return getByValue((Byte)value);
140 }
141 }
142