Skip to content

Commit 44ef6d8

Browse files
dfcoffinclaude
andauthored
feat: ESPI 4.0 Schema Compliance - Phase 0.4: Usage Domain Enums Batch 3 (#108)
Implements third batch of ESPI usage domain enumerations from espi.xsd: - ItemKind (10 values) - Billing line item classifications - ServiceKind (10 values) - Service types at UsagePoint - UnitSymbolKind (124 values) - Base units of measure All enums include: - Apache License 2.0 header (copyright 2025 Green Button Alliance, Inc.) - JAXB/Jakarta XML binding annotations (@XmlType, @XmlEnum, @XmlEnumValue) - getValue() and fromValue(int) methods - Comprehensive Javadoc from XSD documentation with line numbers - Type-safe enum constants with integer values Total enum values in batch: 144 Per ESPI 4.0 specification (NAESB REQ.21) Unit tests: 638/638 passed Related to #101 Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 544ce1f commit 44ef6d8

3 files changed

Lines changed: 1163 additions & 0 deletions

File tree

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
* Copyright 2025 Green Button Alliance, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.greenbuttonalliance.espi.common.domain.usage.enums;
18+
19+
import jakarta.xml.bind.annotation.XmlEnum;
20+
import jakarta.xml.bind.annotation.XmlEnumValue;
21+
import jakarta.xml.bind.annotation.XmlType;
22+
23+
/**
24+
* Enumeration for ItemKind values.
25+
*
26+
* [extension] Code for classification billing line items.
27+
* Per ESPI 4.0 espi.xsd lines 1790-1850.
28+
*/
29+
@XmlType(name = "ItemKind", namespace = "http://naesb.org/espi")
30+
@XmlEnum
31+
public enum ItemKind {
32+
33+
/**
34+
* Energy Generation Fee. A charge for generation of energy.
35+
* XSD value: 1 (line 1797)
36+
*/
37+
@XmlEnumValue("1")
38+
ENERGY_GENERATION_FEE(1),
39+
40+
/**
41+
* Energy Delivery Fee. A charge for delivery of energy.
42+
* XSD value: 2 (line 1802)
43+
*/
44+
@XmlEnumValue("2")
45+
ENERGY_DELIVERY_FEE(2),
46+
47+
/**
48+
* Energy Usage Fee. A charge for electricity, natural gas, water consumption.
49+
* XSD value: 3 (line 1807)
50+
*/
51+
@XmlEnumValue("3")
52+
ENERGY_USAGE_FEE(3),
53+
54+
/**
55+
* Administrative Fee. A fee for administrative services.
56+
* XSD value: 4 (line 1812)
57+
*/
58+
@XmlEnumValue("4")
59+
ADMINISTRATIVE_FEE(4),
60+
61+
/**
62+
* Tax. A local, state, or federal energy tax.
63+
* XSD value: 5 (line 1817)
64+
*/
65+
@XmlEnumValue("5")
66+
TAX(5),
67+
68+
/**
69+
* Energy Generation Credit. A credit, discount or rebate for generation of energy.
70+
* XSD value: 6 (line 1822)
71+
*/
72+
@XmlEnumValue("6")
73+
ENERGY_GENERATION_CREDIT(6),
74+
75+
/**
76+
* Energy Delivery Credit. A credit, discount or rebate for delivery of energy.
77+
* XSD value: 7 (line 1827)
78+
*/
79+
@XmlEnumValue("7")
80+
ENERGY_DELIVERY_CREDIT(7),
81+
82+
/**
83+
* Administrative Credit. A credit, discount or rebate for administrative services.
84+
* XSD value: 8 (line 1832)
85+
*/
86+
@XmlEnumValue("8")
87+
ADMINISTRATIVE_CREDIT(8),
88+
89+
/**
90+
* Payment. A payment for a previous billing.
91+
* XSD value: 9 (line 1837)
92+
*/
93+
@XmlEnumValue("9")
94+
PAYMENT(9),
95+
96+
/**
97+
* Information. An informational line item.
98+
* XSD value: 10 (line 1842)
99+
*/
100+
@XmlEnumValue("10")
101+
INFORMATION(10);
102+
103+
private final int value;
104+
105+
ItemKind(int value) {
106+
this.value = value;
107+
}
108+
109+
public int getValue() {
110+
return value;
111+
}
112+
113+
public static ItemKind fromValue(int value) {
114+
for (ItemKind kind : ItemKind.values()) {
115+
if (kind.value == value) {
116+
return kind;
117+
}
118+
}
119+
throw new IllegalArgumentException("Invalid ItemKind value: " + value);
120+
}
121+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/*
2+
* Copyright 2025 Green Button Alliance, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.greenbuttonalliance.espi.common.domain.usage.enums;
18+
19+
import jakarta.xml.bind.annotation.XmlEnum;
20+
import jakarta.xml.bind.annotation.XmlEnumValue;
21+
import jakarta.xml.bind.annotation.XmlType;
22+
23+
/**
24+
* Enumeration for ServiceKind values.
25+
*
26+
* Kind of service represented by the UsagePoint.
27+
* Per ESPI 4.0 espi.xsd lines 3552-3622.
28+
*/
29+
@XmlType(name = "ServiceKind", namespace = "http://naesb.org/espi")
30+
@XmlEnum
31+
public enum ServiceKind {
32+
33+
/**
34+
* Electricity service.
35+
* XSD value: 0 (line 3559)
36+
*/
37+
@XmlEnumValue("0")
38+
ELECTRICITY(0),
39+
40+
/**
41+
* Gas service.
42+
* XSD value: 1 (line 3565)
43+
*/
44+
@XmlEnumValue("1")
45+
GAS(1),
46+
47+
/**
48+
* Water service.
49+
* XSD value: 2 (line 3571)
50+
*/
51+
@XmlEnumValue("2")
52+
WATER(2),
53+
54+
/**
55+
* Time service.
56+
* XSD value: 3 (line 3577)
57+
*/
58+
@XmlEnumValue("3")
59+
TIME(3),
60+
61+
/**
62+
* Heat service.
63+
* XSD value: 4 (line 3583)
64+
*/
65+
@XmlEnumValue("4")
66+
HEAT(4),
67+
68+
/**
69+
* Refuse (waster) service.
70+
* XSD value: 5 (line 3589)
71+
*/
72+
@XmlEnumValue("5")
73+
REFUSE(5),
74+
75+
/**
76+
* Sewerage service.
77+
* XSD value: 6 (line 3595)
78+
*/
79+
@XmlEnumValue("6")
80+
SEWERAGE(6),
81+
82+
/**
83+
* Rates (e.g. tax, charge, toll, duty, tariff, etc.) service.
84+
* XSD value: 7 (line 3601)
85+
*/
86+
@XmlEnumValue("7")
87+
RATES(7),
88+
89+
/**
90+
* TV license service.
91+
* XSD value: 8 (line 3607)
92+
*/
93+
@XmlEnumValue("8")
94+
TV_LICENCE(8),
95+
96+
/**
97+
* Internet service.
98+
* XSD value: 9 (line 3613)
99+
*/
100+
@XmlEnumValue("9")
101+
INTERNET(9);
102+
103+
private final int value;
104+
105+
ServiceKind(int value) {
106+
this.value = value;
107+
}
108+
109+
public int getValue() {
110+
return value;
111+
}
112+
113+
public static ServiceKind fromValue(int value) {
114+
for (ServiceKind kind : ServiceKind.values()) {
115+
if (kind.value == value) {
116+
return kind;
117+
}
118+
}
119+
throw new IllegalArgumentException("Invalid ServiceKind value: " + value);
120+
}
121+
}

0 commit comments

Comments
 (0)