Skip to content

Commit 5d68f41

Browse files
JavaSaBrCopilot
andauthored
Update rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1573d7e commit 5d68f41

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

rlib-common/src/main/java/javasabr/rlib/common/AliasedEnum.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,30 @@
22

33
import java.util.Collection;
44

5+
/**
6+
* Marks an {@link Enum} whose constants expose one or more string aliases.
7+
* <p>
8+
* Implementing enums can provide alternative string representations for each constant,
9+
* which can be used, for example, for parsing user input, configuration values,
10+
* or external identifiers that do not necessarily match the constant {@code name()}.
11+
*
12+
* @param <T> the concrete enum type implementing this interface
13+
*/
514
public interface AliasedEnum<T extends Enum<T>> {
615

16+
/**
17+
* Returns the string aliases associated with this enum constant.
18+
* <p>
19+
* An alias is an alternative textual identifier for the constant, such as a
20+
* short name, legacy name, or external code, that can be used for lookup
21+
* or serialization instead of the enum's {@link Enum#name()}.
22+
* <p>
23+
* Implementations should never return {@code null}; an empty collection
24+
* indicates that the constant has no aliases. Callers should not modify
25+
* the returned collection unless the implementation explicitly documents
26+
* that it is mutable.
27+
*
28+
* @return a non-{@code null} collection of aliases for this constant
29+
*/
730
Collection<String> aliases();
831
}

0 commit comments

Comments
 (0)