diff options
author | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2025-06-15 19:42:01 -0500 |
---|---|---|
committer | Adrien Hopkins <adrien.p.hopkins@gmail.com> | 2025-06-15 19:42:01 -0500 |
commit | 2fdbc084fd1d78f0b7633db34460b1195de264f3 (patch) | |
tree | 4c908950d9b049394f8160b8159b498aec586ecc /src/main/java/sevenUnits/utils/Nameable.java | |
parent | ed53492243ecad8d975401a97f5b634328ad2c71 (diff) | |
parent | bccb5b5e3452421c81c1fb58f83391ba6584807c (diff) |
See the tag 'v1.0.0' or the changelog for more information about this
release.
Diffstat (limited to 'src/main/java/sevenUnits/utils/Nameable.java')
-rw-r--r-- | src/main/java/sevenUnits/utils/Nameable.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/sevenUnits/utils/Nameable.java b/src/main/java/sevenUnits/utils/Nameable.java index 3959a64..166de55 100644 --- a/src/main/java/sevenUnits/utils/Nameable.java +++ b/src/main/java/sevenUnits/utils/Nameable.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2020 Adrien Hopkins + * Copyright (C) 2020, 2022, 2024, 2025 Adrien Hopkins * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -24,15 +24,17 @@ import java.util.Set; * and symbol data should be immutable. * * @since 2020-09-07 + * @since v0.3.0 */ public interface Nameable { /** * @return a name for the object - if there's a primary name, it's that, * otherwise the symbol, otherwise "Unnamed" * @since 2022-02-26 + * @since v0.4.0 */ default String getName() { - final NameSymbol ns = this.getNameSymbol(); + final var ns = this.getNameSymbol(); return ns.getPrimaryName().or(ns::getSymbol).orElse("Unnamed"); } @@ -40,12 +42,14 @@ public interface Nameable { * @return a {@code NameSymbol} that contains this object's primary name, * symbol and other names * @since 2020-09-07 + * @since v0.3.0 */ NameSymbol getNameSymbol(); /** * @return set of alternate names * @since 2020-09-07 + * @since v0.3.0 */ default Set<String> getOtherNames() { return this.getNameSymbol().getOtherNames(); @@ -54,6 +58,7 @@ public interface Nameable { /** * @return preferred name of object * @since 2020-09-07 + * @since v0.3.0 */ default Optional<String> getPrimaryName() { return this.getNameSymbol().getPrimaryName(); @@ -63,15 +68,17 @@ public interface Nameable { * @return a short name for the object - if there's a symbol, it's that, * otherwise the symbol, otherwise "Unnamed" * @since 2022-02-26 + * @since v0.4.0 */ default String getShortName() { - final NameSymbol ns = this.getNameSymbol(); + final var ns = this.getNameSymbol(); return ns.getSymbol().or(ns::getPrimaryName).orElse("Unnamed"); } /** * @return short symbol representing object * @since 2020-09-07 + * @since v0.3.0 */ default Optional<String> getSymbol() { return this.getNameSymbol().getSymbol(); |