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 import net.sf.jasperreports.engine.JRVariable;
27
28
29 /**
30 * @author Sanda Zaharia (shertage@users.sourceforge.net)
31 */
32 public enum IncrementTypeEnum implements JREnum
33 {
34 /**
35 * The variable never gets incremented during the report-filling process.
36 */
37 REPORT((byte)1, "Report"),
38
39 /**
40 * The variable is incremented with each new page.
41 */
42 PAGE((byte)2, "Page"),
43
44 /**
45 * The variable is incremented with each new column.
46 */
47 COLUMN((byte)3, "Column"),
48
49 /**
50 * The variable is incremented every time the group specified by the {@link JRVariable#getIncrementGroup()} method breaks.
51 */
52 GROUP((byte)4, "Group"),
53
54 /**
55 * The variable is incremented with every record during the iteration through the data source.
56 */
57 NONE((byte)5, "None");
58
59 /**
60 *
61 */
62 private final transient byte value;
63 private final transient String name;
64
65 private IncrementTypeEnum(byte value, String name)
66 {
67 this.value = value;
68 this.name = name;
69 }
70
71 /**
72 * @deprecated Used only by deprecated serialized fields.
73 */
74 @Override
75 public Byte getValueByte()
76 {
77 return value;
78 }
79
80 @Override
81 @SuppressWarnings("deprecation")
82 public final byte getValue()
83 {
84 return value;
85 }
86
87 @Override
88 public String getName()
89 {
90 return name;
91 }
92
93 /**
94 *
95 */
96 public static IncrementTypeEnum getByName(String name)
97 {
98 return EnumUtil.getEnumByName(values(), name);
99 }
100
101 /**
102 * @deprecated Used only by deprecated serialized fields.
103 */
104 public static IncrementTypeEnum getByValue(Byte value)
105 {
106 return (IncrementTypeEnum)EnumUtil.getByValue(values(), value);
107 }
108
109 /**
110 * @deprecated Used only by deprecated serialized fields.
111 */
112 public static IncrementTypeEnum getByValue(byte value)
113 {
114 return getByValue((Byte)value);
115 }
116 }
117