FR: Use PropertyName value as enum value
See original GitHub issueThis is a request to cherry-pick https://github.com/firebase/firebase-android-sdk/issues/239
The example from that project:
public enum MyEnum {
@PropertyName("one")
ONE,
@PropertyName("secondOne")
SECOND_ONE
}
- When deserializing:
- “one” will be mapped to ONE
- “secondOne” will be mapped to SECOND_ONE
- When serializing:
- ONE will be mapped to “one”
- SECOND_ONE will be mapped to “secondOne”
The cherry-pick is available here: https://github.com/vi-technologies/firebase-admin-java/commit/faac58676ae7539010139ae9ad1b8b717bff8bfd
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Create Class Property Name from Enum Value - Stack Overflow
I don't know any possible way to obtain what you want with a class. But if you want, you could obtain the desired...
Read more >Enum.GetName Method (System) - Microsoft Learn
Retrieves the name of the constant in the specified enumeration that has the specified value.
Read more >TypeScript string enums, and when and how to use them
The enums keyword offers a way for us to define a finite set of values — usually as named constants in a strongly...
Read more >Set the value of a property that has been declared as an Enum ...
Set the value of a property that has been declared as an Enum type using reflection : PropertyInfo « Reflection « C# /...
Read more >How To Play With Enum in C# - C# Corner
How to get enum variable name by its value in C#? · ///This is used to get Enum values as array. · private...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Got it, looks like we were transitively depending on an old version of
google-cloud-firestore
(that didn’t support this use case). All cleared up, thanks.Our Firestore support is entirely provided by the
google-cloud-firestore
library. When a developer callsFirestoreClient.getFirestore()
, we simply call out to that library.