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 Teodor Danciu (teodord@users.sourceforge.net)
31 */
32 public enum EvaluationTimeEnum implements JREnum
33 {
34 /**
35 * A constant specifying that an expression should be evaluated at the exact moment in the filling process
36 * when it is encountered.
37 */
38 NOW((byte)1, "Now"),
39
40 /**
41 * A constant specifying that an expression should be evaluated at the end of the filling process.
42 */
43 REPORT((byte)2, "Report"),
44
45 /**
46 * A constant specifying that an expression should be evaluated after each page is filled.
47 */
48 PAGE((byte)3, "Page"),
49
50 /**
51 * A constant specifying that an expression should be evaluated after each column is filled.
52 */
53 COLUMN((byte)4, "Column"),
54
55 /**
56 * A constant specifying that an expression should be evaluated after each group break.
57 */
58 GROUP((byte)5, "Group"),
59
60 /**
61 * The element will be evaluated at band end.
62 */
63 BAND((byte)6, "Band"),
64
65 /**
66 * Evaluation time indicating that each variable participating in the expression
67 * should be evaluated at a time decided by the engine.
68 * <p/>
69 * Variables will be evaluated at a time corresponding to their reset type.
70 * Fields are evaluated "now", i.e. at the time the band the element lies on gets filled.
71 * <p/>
72 * This evaluation type should be used when report elements having expressions that combine
73 * values evaluated at different times are required (e.g. percentage out of a total).
74 * <p/>
75 * NB: avoid using this evaluation type when other types suffice as it can lead
76 * to performance loss.
77 */
78 AUTO((byte)7, "Auto"),
79
80 /**
81 * Used for elements that are evaluated at the moment the master report ends.
82 *
83 * @see JRVariable#MASTER_CURRENT_PAGE
84 * @see JRVariable#MASTER_TOTAL_PAGES
85 */
86 MASTER((byte) 8, "Master");
87
88 /**
89 *
90 */
91 private final transient byte value;
92 private final transient String name;
93
94 private EvaluationTimeEnum(byte value, String name)
95 {
96 this.value = value;
97 this.name = name;
98 }
99
100 /**
101 * @deprecated Used only by deprecated serialized fields.
102 */
103 @Override
104 public Byte getValueByte()
105 {
106 return value;
107 }
108
109 /**
110 * @deprecated Used only by deprecated serialized fields.
111 */
112 @Override
113 public final byte getValue()
114 {
115 return value;
116 }
117
118 @Override
119 public String getName()
120 {
121 return name;
122 }
123
124 /**
125 *
126 */
127 public static EvaluationTimeEnum getByName(String name)
128 {
129 return EnumUtil.getEnumByName(values(), name);
130 }
131
132 /**
133 * @deprecated Used only by deprecated serialized fields.
134 */
135 public static EvaluationTimeEnum getByValue(Byte value)
136 {
137 return (EvaluationTimeEnum)EnumUtil.getByValue(values(), value);
138 }
139
140 /**
141 * @deprecated Used only by deprecated serialized fields.
142 */
143 public static EvaluationTimeEnum getByValue(byte value)
144 {
145 return getByValue((Byte)value);
146 }
147 }
148