Stay organized with collections
Save and categorize content based on your preferences.
EnumConstantNotPresentException
open class EnumConstantNotPresentException : RuntimeException
Thrown when an application tries to access an enum constant by name and the enum type contains no constant with the specified name. This exception can be thrown by the .
Summary
Public constructors |
Constructs an EnumConstantNotPresentException for the specified constant.
|
Public methods |
open String! |
Returns the name of the missing enum constant.
|
open Class<out Enum<Enum<*>>!>! |
Returns the type of the missing enum constant.
|
Public constructors
EnumConstantNotPresentException
EnumConstantNotPresentException(
enumType: Class<out Enum<Enum<*>>!>!,
constantName: String!)
Constructs an EnumConstantNotPresentException
for the specified constant.
Parameters |
enumType |
Class<out Enum<Enum<*>>!>!: the type of the missing enum constant |
constantName |
String!: the name of the missing enum constant |
Public methods
constantName
open fun constantName(): String!
Returns the name of the missing enum constant.
Return |
String! |
the name of the missing enum constant |
enumType
open fun enumType(): Class<out Enum<Enum<*>>!>!
Returns the type of the missing enum constant.
Return |
Class<out Enum<Enum<*>>!>! |
the type of the missing enum constant |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# EnumConstantNotPresentException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nEnumConstantNotPresentException\n===============================\n\n```\nopen class EnumConstantNotPresentException : RuntimeException\n```\n\n|---|---|---|---|------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||||\n| ↳ | [kotlin.Throwable](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html) ||||\n| | ↳ | [java.lang.Exception](/reference/kotlin/java/lang/Exception) |||\n| | | ↳ | [java.lang.RuntimeException](/reference/kotlin/java/lang/RuntimeException) ||\n| | | | ↳ | [java.lang.EnumConstantNotPresentException](#) |\n\nThrown when an application tries to access an enum constant by name and the enum type contains no constant with the specified name. This exception can be thrown by the .\n\nSummary\n-------\n\n| Public constructors ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [EnumConstantNotPresentException](#EnumConstantNotPresentException(java.lang.Class,%20kotlin.String))`(`enumType:` `[Class](/reference/kotlin/java/lang/Class)\u003cout` `[Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\u003c[Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\u003c*\u003e\u003e!\u003e!`, `constantName:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Constructs an `EnumConstantNotPresentException` for the specified constant. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------|\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [constantName](#constantName())`()` Returns the name of the missing enum constant. |\n| open [Class](/reference/kotlin/java/lang/Class)\\\u003cout [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\\\u003c[Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\\\u003c\\*\\\u003e\\\u003e!\\\u003e! | [enumType](#enumType())`()` Returns the type of the missing enum constant. |\n\nPublic constructors\n-------------------\n\n### EnumConstantNotPresentException\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nEnumConstantNotPresentException(\n enumType: Class\u003cout Enum\u003cEnum\u003c*\u003e\u003e!\u003e!, \n constantName: String!)\n```\n\nConstructs an `EnumConstantNotPresentException` for the specified constant.\n\n| Parameters ||\n|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `enumType` | [Class](/reference/kotlin/java/lang/Class)\\\u003cout [Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\\\u003c[Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\\\u003c\\*\\\u003e\\\u003e!\\\u003e!: the type of the missing enum constant |\n| `constantName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: the name of the missing enum constant |\n\nPublic methods\n--------------\n\n### constantName\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun constantName(): String!\n```\n\nReturns the name of the missing enum constant.\n\n| Return ||\n|-----------------------------------------------------------------------------------|---------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the name of the missing enum constant |\n\n### enumType\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun enumType(): Class\u003cout Enum\u003cEnum\u003c*\u003e\u003e!\u003e!\n```\n\nReturns the type of the missing enum constant.\n\n| Return ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------|\n| [Class](/reference/kotlin/java/lang/Class)\u003cout` `[Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\u003c[Enum](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-enum/index.html)\u003c*\u003e\u003e!\u003e! | the type of the missing enum constant |"]]