1 /*
2 * Metis: Java Data Framework
3 * Copyright 2012-2026. Tony Washer
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17 package io.github.tonywasher.joceanus.metis.field;
18
19 /**
20 * Enumeration of FieldSet states.
21 *
22 * @author Tony Washer
23 */
24 public enum MetisFieldState {
25 /**
26 * Normal state.
27 */
28 NORMAL,
29
30 /**
31 * Changed state.
32 */
33 CHANGED,
34
35 /**
36 * New state.
37 */
38 NEW,
39
40 /**
41 * Deleted state.
42 */
43 DELETED,
44
45 /**
46 * Restored state.
47 */
48 RESTORED,
49
50 /**
51 * Error state.
52 */
53 ERROR;
54
55 /**
56 * Is the state in error?
57 *
58 * @return true/false
59 */
60 public boolean isError() {
61 return this == ERROR;
62 }
63
64 /**
65 * Is the state changed?
66 *
67 * @return true/false
68 */
69 public boolean isChanged() {
70 switch (this) {
71 case CHANGED:
72 case NEW:
73 case RESTORED:
74 case ERROR:
75 return true;
76 default:
77 return false;
78 }
79 }
80 }