38
38
*/
39
39
public enum Estado {
40
40
41
- AC (12 ) {
41
+ AC (12 , "24" ) {
42
42
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
43
43
return new IEAcreValidator (messageProducer , isFormatted );
44
44
}
45
45
46
46
},
47
- AL (27 ) {
47
+ AL (27 , "17" ) {
48
48
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
49
49
return new IEAlagoasValidator (messageProducer , isFormatted );
50
50
}
51
51
52
52
},
53
- AP (16 ) {
53
+ AP (16 , "25" ) {
54
54
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
55
55
return new IEAmapaValidator (messageProducer , isFormatted );
56
56
}
57
57
58
58
},
59
- AM (13 ) {
59
+ AM (13 , "22" ) {
60
60
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
61
61
return new IEAmazonasValidator (messageProducer , isFormatted );
62
62
}
63
63
64
64
},
65
- BA (29 ) {
65
+ BA (29 , "05" ) {
66
66
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
67
67
return new IEBahiaValidator (messageProducer , isFormatted );
68
68
}
69
69
70
70
},
71
- CE (23 ) {
71
+ CE (23 , "07" ) {
72
72
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
73
73
return new IECearaValidator (messageProducer , isFormatted );
74
74
}
75
75
76
76
},
77
- DF (53 ) {
77
+ DF (53 , "20" ) {
78
78
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
79
79
return new IEDistritoFederalValidator (messageProducer , isFormatted );
80
80
}
81
81
82
82
},
83
- ES (32 ) {
83
+ ES (32 , "14" ) {
84
84
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
85
85
return new IEEspiritoSantoValidator (messageProducer , isFormatted );
86
86
}
87
87
88
88
},
89
- GO (52 ) {
89
+ GO (52 , "10" ) {
90
90
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
91
91
return new IEGoiasValidator (messageProducer , isFormatted );
92
92
}
93
93
94
94
},
95
- MA (21 ) {
95
+ MA (21 , "11" ) {
96
96
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
97
97
return new IEMaranhaoValidator (messageProducer , isFormatted );
98
98
}
99
99
100
100
},
101
- MT (51 ) {
101
+ MT (51 , "18" ) {
102
102
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
103
103
return new IEMatoGrossoValidator (messageProducer , isFormatted );
104
104
}
105
105
106
106
},
107
- MS (50 ) {
107
+ MS (50 , "19" ) {
108
108
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
109
109
return new IEMatoGrossoDoSulValidator (messageProducer , isFormatted );
110
110
}
111
111
112
112
},
113
- MG (31 ) {
113
+ MG (31 , "02" ) {
114
114
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
115
115
return new IEMinasGeraisValidator (messageProducer , isFormatted );
116
116
}
117
117
118
118
},
119
- PA (15 ) {
119
+ PA (15 , "13" ) {
120
120
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
121
121
return new IEParaValidator (messageProducer , isFormatted );
122
122
}
123
123
124
124
},
125
- PB (25 ) {
125
+ PB (25 , "12" ) {
126
126
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
127
127
return new IEParaibaValidator (messageProducer , isFormatted );
128
128
}
129
129
130
130
},
131
- PR (41 ) {
131
+ PR (41 , "06" ) {
132
132
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
133
133
return new IEParanaValidator (messageProducer , isFormatted );
134
134
}
135
135
136
136
},
137
- PE (26 ) {
137
+ PE (26 , "08" ) {
138
138
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
139
139
return new IEPernambucoValidator (messageProducer , isFormatted );
140
140
}
141
141
142
142
},
143
- PI (22 ) {
143
+ PI (22 , "15" ) {
144
144
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
145
145
return new IEPiauiValidator (messageProducer , isFormatted );
146
146
}
147
147
148
148
},
149
- RJ (33 ) {
149
+ RJ (33 , "03" ) {
150
150
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
151
151
return new IERioDeJaneiroValidator (messageProducer , isFormatted );
152
152
}
153
153
154
154
},
155
- RN (24 ) {
155
+ RN (24 , "16" ) {
156
156
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
157
157
return new IERioGrandeDoNorteValidator (messageProducer , isFormatted );
158
158
}
159
159
160
160
},
161
- RS (43 ) {
161
+ RS (43 , "04" ) {
162
162
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
163
163
return new IERioGrandeDoSulValidator (messageProducer , isFormatted );
164
164
}
165
165
166
166
},
167
- RO (11 ) {
167
+ RO (11 , "23" ) {
168
168
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
169
169
return new IERondoniaValidator (messageProducer , isFormatted );
170
170
}
171
171
172
172
},
173
- RR (14 ) {
173
+ RR (14 , "26" ) {
174
174
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
175
175
return new IERoraimaValidator (messageProducer , isFormatted );
176
176
}
177
177
178
178
},
179
- SC (42 ) {
179
+ SC (42 , "09" ) {
180
180
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
181
181
return new IESantaCatarinaValidator (messageProducer , isFormatted );
182
182
}
183
183
184
184
},
185
- SP (35 ) {
185
+ SP (35 , "01" ) {
186
186
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
187
187
return new IESaoPauloValidator (messageProducer , isFormatted );
188
188
}
189
189
190
190
},
191
- SE (28 ) {
191
+ SE (28 , "21" ) {
192
192
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
193
193
return new IESergipeValidator (messageProducer , isFormatted );
194
194
}
195
195
196
196
},
197
- TO (17 ) {
197
+ TO (17 , "27" ) {
198
198
public Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted ) {
199
199
return new IETocantinsValidator (messageProducer , isFormatted );
200
200
}
201
201
202
202
};
203
203
204
204
private final int codigoIBGE ;
205
+
206
+ private final String codigoEleitoral ;
205
207
206
208
/**
207
209
* Retorna um validador de Inscrição Estadual.
@@ -215,15 +217,20 @@ public Validator<String> getIEValidator(MessageProducer messageProducer, boolean
215
217
*/
216
218
public abstract Validator <String > getIEValidator (MessageProducer messageProducer , boolean isFormatted );
217
219
218
- private Estado (int codigoIBGE ) {
220
+ private Estado (int codigoIBGE , String codigoEleitoral ) {
219
221
this .codigoIBGE = codigoIBGE ;
222
+ this .codigoEleitoral = codigoEleitoral ;
220
223
}
221
224
222
225
public int getCodigoIBGE () {
223
226
return codigoIBGE ;
224
227
}
228
+
229
+ public String getCodigoEleitoral () {
230
+ return codigoEleitoral ;
231
+ }
225
232
226
- /**
233
+ /**
227
234
* A região do território brasileiro em que esse estado está localizado.
228
235
*
229
236
* @return Retorna a região em que esse estado está localizado.
@@ -249,4 +256,17 @@ public Regiao regiao() {
249
256
public boolean localizadoEm (Regiao regiao ) {
250
257
return regiao () == regiao ;
251
258
}
259
+
260
+ public static Estado deCodigoEleitoral (String codigo ) {
261
+
262
+ Estado [] estados = Estado .values ();
263
+
264
+ for (Estado estado : estados ) {
265
+ if (estado .getCodigoEleitoral ().equals (codigo )) {
266
+ return estado ;
267
+ }
268
+ }
269
+
270
+ throw new IllegalStateException ("Não foi possível determinar o estado a partir do código eleitoral " + codigo );
271
+ }
252
272
}
0 commit comments