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 ResetTypeEnum implements JREnum
33 {
34 /**
35 * The variable is initialized only once, at the beginning of the report filling process, with the value returned by
36 * the variable's initial value expression.
37 */
38 REPORT((byte)1, "Report"),
39
40 /**
41 * The variable is reinitialized at the beginning of each new page.
42 */
43 PAGE((byte)2, "Page"),
44
45 /**
46 * The variable is reinitialized at the beginning of each new column.
47 */
48 COLUMN((byte)3, "Column"),
49
50 /**
51 * The variable is reinitialized every time the group specified by the {@link JRVariable#getResetGroup()} method breaks.
52 */
53 GROUP((byte)4, "Group"),
54
55 /**
56 * The variable will never be initialized using its initial value expression and will only contain values obtained by
57 * evaluating the variable's expression.
58 */
59 NONE((byte)5, "None"),
60
61 /**
62 * Used internally by the master report page variables to allow the variables to be used in
63 * text fields with {@link EvaluationTimeEnum#AUTO Auto} evaluation time.
64 *
65 * @see JRVariable#MASTER_CURRENT_PAGE
66 * @see JRVariable#MASTER_TOTAL_PAGES
67 */
68 MASTER((byte) 6, "Master");
69
70 /**
71 *
72 */
73 private final transient byte value;
74 private final transient String name;
75
76 private ResetTypeEnum(byte value, String name)
77 {
78 this.value = value;
79 this.name = name;
80 }
81
82 /**
83 * @deprecated Used only by deprecated serialized fields.
84 */
85 @Override
86 public Byte getValueByte()
87 {
88 return value;
89 }
90
91 /**
92 * @deprecated Used only by deprecated serialized fields.
93 */
94 @Override
95 public final byte getValue()
96 {
97 return value;
98 }
99
100 @Override
101 public String getName()
102 {
103 return name;
104 }
105
106 /**
107 *
108 */
109 public static ResetTypeEnum getByName(String name)
110 {
111 return EnumUtil.getEnumByName(values(), name);
112 }
113
114 /**
115 * @deprecated Used only by deprecated serialized fields.
116 */
117 public static ResetTypeEnum getByValue(Byte value)
118 {
119 return (ResetTypeEnum)EnumUtil.getByValue(values(), value);
120 }
121
122 /**
123 *
124 */
125 public static ResetTypeEnum getByValue(byte value)
126 {
127 return getByValue((Byte)value);
128 }
129 }
130