GeezerVison is showing github.com (truncated) — Creating an expandable enum type, converting StorageClass by garrettjonesgoogle · Pull Request #1937 · googleapis/google-cloud-java
Conversation
Design notes:
- I made it so that converting an enum into a StorageEnumValue is not disruptive at a code level (e.g. it has
valueOf and values, same as Java enums)
- I am only converting one enum now, and after we agree on the design, I will do a follow-up PR to convert the rest.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The design looks reasonable to me. Just a few comments.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
* 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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
public abstract class StringEnumValue {
|
|
|
private String constant;
|
|
|
|
|
|
@InternalApi
|
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
|
|
|
public StringEnumType(String enumName, ApiFunction<String, EnumT> constructor) {
|
|
|
this.enumName = enumName;
|
|
|
this.constructor = constructor;
|
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
|
|
|
private final String enumName;
|
|
|
private final ApiFunction<String, EnumT> constructor;
|
|
|
private Map<String, EnumT> knownValues = new HashMap<>();
|
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Design looks good to me too. Two points: (1) Is may be possible to push some functionality from StorageClass into StringEnumValue by making StringEnumValue parametrized recursively, e.g. class StringEnumValue<T extends StringEnumValue<T>>. This reduces the code in StorageClass, at the expense of more complexity. (2) Do we need tests for StringEnumValue and StringEnumType?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
(1) Which functionality can be moved up? The only public things in StorageClass are static.
(2) It does make sense to make tests for StringEnumValue and StringEnumType - I'll add those in.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

Changes Unknown when pulling 6db00d3 on garrettjonesgoogle:alt into ** on GoogleCloudPlatform:master**.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

Changes Unknown when pulling d6f19ab on garrettjonesgoogle:alt into ** on GoogleCloudPlatform:master**.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

Changes Unknown when pulling ded5357 on garrettjonesgoogle:alt into ** on GoogleCloudPlatform:master**.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chingor13
pushed a commit
that referenced
this pull request
Jan 22, 2026
#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
chingor13
pushed a commit
that referenced
this pull request
Feb 20, 2026
* 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 <[email protected]>
lqiu96
pushed a commit
that referenced
this pull request
Mar 20, 2026
#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
suztomo
pushed a commit
to suztomo/google-cloud-java
that referenced
this pull request
Mar 23, 2026
Include the COLUMN_DEFAULT value in the DatabaseMetaData that is returned
for the getColumns() method. These were missing, as Spanner previously did
not support default values.
|