Enum

Common
JVM
JS
Native
1.0
abstract class Enum<E : Enum<E>> : Comparable<E>
(Common source) (Native source)

The common base class of all enum classes. See the Kotlin language documentation for more information on enum classes.

Constructors

Common
JVM
JS
Native
1.0

<init>

The common base class of all enum classes. See the Kotlin language documentation for more information on enum classes.

<init>(name: String, ordinal: Int)

Properties

Common
JVM
JS
Native
1.0

name

Returns the name of this enum constant, exactly as declared in its enum declaration.

val name: String
Common
JVM
JS
Native
1.0

ordinal

Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero).

val ordinal: Int

Functions

Common
JVM
JS
Native
1.0

clone

Throws an exception since enum constants cannot be cloned. This method prevents enum classes from inheriting from Cloneable.

fun clone(): Any
Common
JVM
JS
Native
1.0

compareTo

Compares this object with the specified object for order. Returns zero if this object is equal to the specified other object, a negative number if it's less than other, or a positive number if it's greater than other.

fun compareTo(other: E): Int
Common
JVM
JS
Native
1.0

equals

Indicates whether some other object is "equal to" this one. Implementations must fulfil the following requirements:

fun equals(other: Any?): Boolean
Common
JVM
JS
Native
1.0

hashCode

Returns a hash code value for the object. The general contract of hashCode is:

fun hashCode(): Int
Common
JVM
JS
Native
1.0

toString

Returns a string representation of the object.

open fun toString(): String

Extension Properties

JVM
1.7

declaringJavaClass

Returns a Java Class instance of the enum the given constant belongs to.

val <E : Enum<E>> Enum<E>.declaringJavaClass: Class<E>

Extension Functions

Common
JVM
JS
Native
1.0

coerceAtLeast

Ensures that this value is not less than the specified minimumValue.

fun <T : Comparable<T>> T.coerceAtLeast(minimumValue: T): T
Common
JVM
JS
Native
1.0

coerceAtMost

Ensures that this value is not greater than the specified maximumValue.

fun <T : Comparable<T>> T.coerceAtMost(maximumValue: T): T
Common
JVM
JS
Native
1.0

coerceIn

Ensures that this value lies in the specified range minimumValue..maximumValue.

fun <T : Comparable<T>> T.coerceIn(
    minimumValue: T?,
    maximumValue: T?
): T

Ensures that this value lies in the specified range.

fun <T : Comparable<T>> T.coerceIn(
    range: ClosedFloatingPointRange<T>
): T
fun <T : Comparable<T>> T.coerceIn(range: ClosedRange<T>): T
Common
JVM
JS
Native
1.6

compareTo

Compares this object with the specified object for order. Returns zero if this object is equal to the specified other object, a negative number if it's less than other, or a positive number if it's greater than other.

infix fun <T> Comparable<T>.compareTo(other: T): Int
Common
JVM
JS
Native
1.0

rangeTo

Creates a range from this Comparable value to the specified that value.

operator fun <T : Comparable<T>> T.rangeTo(
    that: T
): ClosedRange<T>
Common
JVM
JS
Native
1.9

rangeUntil

Creates an open-ended range from this Comparable value to the specified that value.

operator fun <T : Comparable<T>> T.rangeUntil(
    that: T
): OpenEndRange<T>

Inheritors

Common
JVM
JS
Native
1.0

AnnotationRetention

Contains the list of possible annotation's retentions.

enum class AnnotationRetention
Common
JVM
JS
Native
1.0

AnnotationTarget

Contains the list of code elements which are the possible annotation targets

enum class AnnotationTarget
Common
JVM
JS
Native
1.0

CharCategory

Represents the character general category in the Unicode specification.

enum class CharCategory
JVM
1.0

CharDirectionality

Represents the Unicode directionality of a character. Character directionality is used to calculate the visual ordering of text.

enum class CharDirectionality
JVM
JRE7
1.0

CopyActionResult

The result of the copyAction function passed to Path.copyToRecursively that specifies further actions when copying an entry.

enum class CopyActionResult
Native
1.3

CpuArchitecture

Central Processor Unit architecture.

enum class CpuArchitecture
Common
JVM
JS
Native
1.0

DeprecationLevel

Possible levels of a deprecation. The level specifies how the deprecated element usages are reported in code.

enum class DeprecationLevel
Common
JVM
JS
Native
1.6

DurationUnit

The list of possible time measurement units, in which a duration can be expressed.

enum class DurationUnit
JVM
1.0

FileWalkDirection

An enumeration to describe possible walk directions. There are two of them: beginning from parents, ending with children, and beginning from children, ending with parents. Both use depth-first search.

enum class FileWalkDirection
Native
1.3

FutureState

State of the future object.

enum class FutureState
Common
JVM
JS
Native
1.3

InvocationKind

Specifies how many times a function invokes its function parameter in place.

enum class InvocationKind
Common
JVM
JS
Native
1.1

KVariance

Represents variance applied to a type parameter on the declaration site (declaration-site variance), or to a type in a projection (use-site variance).

enum class KVariance
JVM
1.1

KVisibility

Visibility is an aspect of a Kotlin declaration regulating where that declaration is accessible in the source code. Visibility can be changed with one of the following modifiers: public, protected, internal, private.

enum class KVisibility
Common
JVM
JS
Native
1.0

LazyThreadSafetyMode

Specifies how a Lazy instance synchronizes initialization among multiple threads.

enum class LazyThreadSafetyMode
Native
1.3

MemoryModel

Memory model.

enum class MemoryModel
JVM
1.0

OnErrorAction

Enum that can be used to specify behaviour of the copyRecursively() function in exceptional conditions.

enum class OnErrorAction
JVM
JRE7
1.0

OnErrorResult

The result of the onError function passed to Path.copyToRecursively that specifies further actions when an exception occurs.

enum class OnErrorResult
Native
1.3

OsFamily

Operating system family.

enum class OsFamily
JVM
JRE7
1.0

PathWalkOption

An enumeration to provide walk options for Path.walk function. The options can be combined to form the walk order and behavior needed.

enum class PathWalkOption

RegexOption

Provides enumeration values to use to set regular expression options.

Common
JS
Native
1.0
enum class RegexOption
JVM
1.0
enum class RegexOption : FlagEnum
Native
1.3

TransferMode

Note: modern Kotlin/Native memory manager allows to share objects between threads without additional ceremonies, so TransferMode has effect only in legacy memory manager.

enum class TransferMode