Docs Menu

Docs HomeRealm

Enumerations - Java SDK

On this page

  • Usage

Enumerations, also known as enums, are not supported natively in the Java SDK. However, you can use Java and Kotlin enums in your Realm objects if you follow these steps.

To use an enum in a Realm object class, define a field with a type matching the underlying data type of your enum. Create getters and setters for the field that convert the field value between the underlying value and the enum type. You can use the Java's built-in Enum.valueOf() method to convert from the underlying type to the enum type.

←  Field Types - Java SDKCounters - Java SDK →

On this page

Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.