Creating an expandable enum type, converting StorageClass#1937
Creating an expandable enum type, converting StorageClass#1937garrettjonesgoogle merged 3 commits intogoogleapis:masterfrom
Conversation
|
Updates #1832 |
shinfan
left a comment
There was a problem hiding this comment.
The design looks reasonable to me. Just a few comments.
| * Get the StorageClass for the given String constant, and throw an exception if the constant is | ||
| * not recognized. | ||
| */ | ||
| public static StorageClass valueOfStrict(String constant) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| public abstract class StringEnumValue { | ||
| private String constant; | ||
|
|
||
| @InternalApi |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| public StringEnumType(String enumName, ApiFunction<String, EnumT> constructor) { | ||
| this.enumName = enumName; | ||
| this.constructor = constructor; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| private final String enumName; | ||
| private final ApiFunction<String, EnumT> constructor; | ||
| private Map<String, EnumT> knownValues = new HashMap<>(); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Design looks good to me too. Two points: (1) Is may be possible to push some functionality from |
|
(1) Which functionality can be moved up? The only public things in |
|
Changes Unknown when pulling 6db00d3 on garrettjonesgoogle:alt into ** on GoogleCloudPlatform:master**. |
|
Re (1): you are right. |
|
Added unit tests, PTAL |
|
Changes Unknown when pulling d6f19ab on garrettjonesgoogle:alt into ** on GoogleCloudPlatform:master**. |
|
Changes Unknown when pulling ded5357 on garrettjonesgoogle:alt into ** on GoogleCloudPlatform:master**. |
|
LGTM |
#1937) * chore: Update generation configuration at Sat Aug 9 02:31:56 UTC 2025 * chore: Update generation configuration at Sun Aug 10 02:43:05 UTC 2025 * chore: Update generation configuration at Mon Aug 11 02:41:17 UTC 2025 * chore: Update generation configuration at Tue Aug 12 02:32:03 UTC 2025 * chore: Update generation configuration at Wed Aug 13 02:32:41 UTC 2025 * chore: Update generation configuration at Thu Aug 14 02:34:29 UTC 2025 * chore: Update generation configuration at Fri Aug 15 02:34:47 UTC 2025 * chore: Update generation configuration at Sat Aug 16 02:30:30 UTC 2025 * chore: generate libraries at Sat Aug 16 02:31:01 UTC 2025
* chore(main): release 2.28.3-SNAPSHOT * chore: clirr updates Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Neenu1995 <neenushaji@google.com>
Design notes:
valueOfandvalues, same as Java enums)