Skip to content

Commit fdb232b

Browse files
committed
Update Named.java
1 parent 6bb67d6 commit fdb232b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/comroid/api/Named.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@
1010
public interface Named extends WrappedFormattable {
1111
/**
1212
* Default implementation to get the primary name.
13-
* If this is an instance of {@link Enum}, returns its {@link Enum#name() enum constant name}.
13+
* By default, invokes {@link #getName()}.
1414
*
1515
* @return The primary name.
1616
*/
1717
@Override
1818
default String getPrimaryName() {
19-
if (this instanceof Enum)
20-
return ((Enum<?>) this).name();
21-
return getAlternateName();
19+
return getName();
2220
}
2321

2422
/**
@@ -33,12 +31,14 @@ default String getAlternateName() {
3331

3432
/**
3533
* Returns the primary common name of this object.
36-
* By default, invokes {@link #getPrimaryName()}.
34+
* If this is an instance of {@link Enum}, returns its {@link Enum#name() enum constant name}.
3735
*
3836
* @return the primary common name.
3937
*/
4038
default String getName() {
41-
return getPrimaryName();
39+
if (this instanceof Enum)
40+
return ((Enum<?>) this).name();
41+
return toString();
4242
}
4343

4444
/**

0 commit comments

Comments
 (0)