Skip to content

Commit 5c398b2

Browse files
committed
refactoring: replace call to deprecated function by its replacement function
replace call to deprecated function getName() by its replacement function getFullName() Signed-off-by: Alexandre Le Jean <alexandre.le-jean@artelys.com>
1 parent 3066cc3 commit 5c398b2

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

iidm/iidm-api/src/main/java/com/powsybl/iidm/network/Country.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public enum Country {
274274
* @deprecated This method is deprecated because not explicit enough as function name() exists.
275275
* Use {@link #getFullName()} instead.
276276
*/
277-
@Deprecated
277+
@Deprecated(forRemoval=false)
278278
public String getName() {
279279
return name;
280280
}

iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/NetworkImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ public int getSubstationCount() {
323323

324324
@Override
325325
public Iterable<Substation> getSubstations(Country country, String tsoId, String... geographicalTags) {
326-
return getSubstations(Optional.ofNullable(country).map(Country::getName).orElse(null), tsoId, geographicalTags);
326+
return getSubstations(Optional.ofNullable(country).map(Country::getFullName).orElse(null), tsoId, geographicalTags);
327327
}
328328

329329
@Override

iidm/iidm-impl/src/main/java/com/powsybl/iidm/network/impl/Substations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static Iterable<Substation> filter(Iterable<Substation> substations,
2828
final String tso,
2929
final String... geographicalTags) {
3030
return StreamSupport.stream(substations.spliterator(), false).filter(substation -> {
31-
if (country != null && !country.equals(substation.getCountry().map(Country::getName).orElse(""))) {
31+
if (country != null && !country.equals(substation.getCountry().map(Country::getFullName).orElse(""))) {
3232
return false;
3333
}
3434
if (tso != null && !tso.equals(substation.getTso())) {

iidm/iidm-tck/src/test/java/com/powsybl/iidm/network/tck/AbstractSubnetworksExplorationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,11 @@ public void testExploreSubstations() {
378378
assertIds(List.of(n1Substation1, n2Substation1), merged.getSubstations(Country.FR, null));
379379
assertIds(List.of(n1Substation1), subnetwork1.getSubstations(Country.FR, null));
380380
assertIds(List.of(n2Substation1), subnetwork2.getSubstations(Country.FR, null));
381-
var countryName = Country.ES.getName();
381+
var countryName = Country.ES.getFullName();
382382
assertIds(List.of(n1Substation2), merged.getSubstations(countryName, null));
383383
assertIds(List.of(n1Substation2), subnetwork1.getSubstations(countryName, null));
384384
assertFalse(subnetwork2.getSubstations(countryName, null).iterator().hasNext());
385-
countryName = Country.BE.getName();
385+
countryName = Country.BE.getFullName();
386386
assertIds(List.of(n2Substation2), merged.getSubstations(countryName, null));
387387
assertFalse(subnetwork1.getSubstations(countryName, null).iterator().hasNext());
388388
assertIds(List.of(n2Substation2), subnetwork2.getSubstations(countryName, null));

0 commit comments

Comments
 (0)