Start a new topic

How can I use custom enums within my Entity?

I want to store a custom enum in my collection, how can I do this?
1 Comment

When defining your enum, add the @Value annotation to each possible value. Then, in your GenericJson class you can use the standard @Key annotation and use the enum as you would any other type of value.



For example:



import com.google.api.client.util.Value;



public enum COUNTER{

@Value

ONE,

@Value

TWO;

}



and then, in your GenericJson class, you can add the following:





@Key

private COUNTER myCount;

Login or Signup to post a comment