Skip to content

Commit 33f5d4f

Browse files
dfcoffinclaude
andauthored
feat(phase-0.2): Generate usage domain enums batch 1 (#106)
Generated 5 core ESPI usage domain enumerations: - AccumulationKind (11 values) - CommodityKind (27 values) - DataQualifierKind (15 values) - FlowDirectionKind (22 values) - MeasurementKind (125 values) All enums include: - Apache License 2.0 (2025) - JAXB annotations for XML marshalling - Comprehensive Javadoc from XSD - getValue() and fromValue() methods Based on ESPI 4.0 espi.xsd schema. Unit tests: 638/638 passed Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 3e3034d commit 33f5d4f

File tree

5 files changed

+1737
-0
lines changed

5 files changed

+1737
-0
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
/*
2+
*
3+
* Copyright (c) 2025 Green Button Alliance, Inc.
4+
*
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
*/
19+
20+
package org.greenbuttonalliance.espi.common.domain.usage.enums;
21+
22+
import jakarta.xml.bind.annotation.XmlEnum;
23+
import jakarta.xml.bind.annotation.XmlEnumValue;
24+
import jakarta.xml.bind.annotation.XmlType;
25+
26+
/**
27+
* Enumeration for AccumulationKind values.
28+
*
29+
* Code indicating how value is accumulated over time for Readings of ReadingType.
30+
* The list of valid values per the standard are defined in AccumulationBehaviorType.
31+
* Per ESPI 4.0 espi.xsd lines 1851-1927.
32+
*/
33+
@XmlType(name = "AccumulationKind", namespace = "http://naesb.org/espi")
34+
@XmlEnum
35+
public enum AccumulationKind {
36+
37+
/**
38+
* Not Applicable or implied by the unit of measure.
39+
* XSD value: 0 (line 1858)
40+
*/
41+
@XmlEnumValue("0")
42+
NONE(0),
43+
44+
/**
45+
* Bulk Quantity. Accumulation behaviour is not relevant.
46+
* XSD value: 1 (line 1864)
47+
*/
48+
@XmlEnumValue("1")
49+
BULK_QUANTITY(1),
50+
51+
/**
52+
* The sum of the previous billing period values and the present period value.
53+
* Note: "ContinuousCumulative" is commonly used in conjunction with "demand."
54+
* The "ContinuousCumulative Demand" would be the cumulative sum of the previous
55+
* billing period maximum demand values (as occurring with each demand reset)
56+
* summed with the present period maximum demand value (which has yet to be reset.)
57+
* XSD value: 2 (line 1870)
58+
*/
59+
@XmlEnumValue("2")
60+
CONTINUOUS_CUMULATIVE(2),
61+
62+
/**
63+
* The sum of the previous billing period values.
64+
* Note: "Cumulative" is commonly used in conjunction with "demand." Each demand
65+
* reset causes the maximum demand value for the present billing period (since the
66+
* last demand reset) to accumulate as an accumulative total of all maximum demands.
67+
* So instead of "zeroing" the demand register, a demand reset has the effect of
68+
* adding the present maximum demand to this accumulating total.
69+
* XSD value: 3 (line 1876)
70+
*/
71+
@XmlEnumValue("3")
72+
CUMULATIVE(3),
73+
74+
/**
75+
* The difference between the value at the end of the prescribed interval and the
76+
* beginning of the interval. This is used for incremental interval data.
77+
* Note: One common application would be for load profile data, another use might
78+
* be to report the number of events within an interval (such as the number of
79+
* equipment energizations within the specified period of time.)
80+
* XSD value: 4 (line 1882)
81+
*/
82+
@XmlEnumValue("4")
83+
DELTA_DATA(4),
84+
85+
/**
86+
* As if a needle is swung out on the meter face to a value to indicate the current value.
87+
* Note: An "indicating" value is typically measured over hundreds of milliseconds or
88+
* greater, or may imply a "pusher" mechanism to capture a value. Compare this to
89+
* "instantaneous" which is measured over a shorter period of time.
90+
* XSD value: 6 (line 1888)
91+
*/
92+
@XmlEnumValue("6")
93+
INDICATING(6),
94+
95+
/**
96+
* A form of accumulation which is selective with respect to time.
97+
* Note: "Summation" could be considered a specialization of "Bulk Quantity" according
98+
* to the rules of inheritance where "Summation" selectively accumulates pulses over a
99+
* timing pattern, and "BulkQuantity" accumulates pulses all of the time.
100+
* XSD value: 9 (line 1894)
101+
*/
102+
@XmlEnumValue("9")
103+
SUMMATION(9),
104+
105+
/**
106+
* A form of computation which introduces a time delay characteristic to the data value.
107+
* XSD value: 10 (line 1900)
108+
*/
109+
@XmlEnumValue("10")
110+
TIME_DELAY(10),
111+
112+
/**
113+
* Typically measured over the fastest period of time allowed by the definition of the
114+
* metric (usually milliseconds or tens of milliseconds.)
115+
* Note: "Instantaneous" was moved to attribute #3 in 61968-9Ed2 from attribute #1
116+
* in 61968-9Ed1.
117+
* XSD value: 12 (line 1906)
118+
*/
119+
@XmlEnumValue("12")
120+
INSTANTANEOUS(12),
121+
122+
/**
123+
* Latch the smallest value.
124+
* XSD value: 13 (line 1912)
125+
*/
126+
@XmlEnumValue("13")
127+
LATCHING_QUANTITY(13),
128+
129+
/**
130+
* When this description is applied to a metered value, it implies that the value is
131+
* a form of accumulation which is bounded by reset actions, but the reading value
132+
* itself is not reset to zero.
133+
* XSD value: 14 (line 1918)
134+
*/
135+
@XmlEnumValue("14")
136+
BOUNDED_QUANTITY(14);
137+
138+
private final int value;
139+
140+
AccumulationKind(int value) {
141+
this.value = value;
142+
}
143+
144+
public int getValue() {
145+
return value;
146+
}
147+
148+
public static AccumulationKind fromValue(int value) {
149+
for (AccumulationKind kind : AccumulationKind.values()) {
150+
if (kind.value == value) {
151+
return kind;
152+
}
153+
}
154+
throw new IllegalArgumentException("Invalid AccumulationKind value: " + value);
155+
}
156+
}

0 commit comments

Comments
 (0)