diff --git a/java/com/facebook/yoga/YogaLayoutType.java b/java/com/facebook/yoga/YogaLayoutType.java deleted file mode 100644 index 8c861ff7..00000000 --- a/java/com/facebook/yoga/YogaLayoutType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.yoga; - -public enum YogaLayoutType { - LAYOUT(0), - MEASURE(1), - CACHED_LAYOUT(2), - CACHED_MEASURE(3); - - private final int mIntValue; - - YogaLayoutType(int intValue) { - mIntValue = intValue; - } - - public int intValue() { - return mIntValue; - } - - public static YogaLayoutType fromInt(int value) { - switch (value) { - case 0: return LAYOUT; - case 1: return MEASURE; - case 2: return CACHED_LAYOUT; - case 3: return CACHED_MEASURE; - default: throw new IllegalArgumentException("Unknown enum value: " + value); - } - } -} diff --git a/java/com/facebook/yoga/YogaLayoutType.kt b/java/com/facebook/yoga/YogaLayoutType.kt new file mode 100644 index 00000000..6177a412 --- /dev/null +++ b/java/com/facebook/yoga/YogaLayoutType.kt @@ -0,0 +1,27 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.yoga + +public enum class YogaLayoutType(public val intValue: Int) { + LAYOUT(0), + MEASURE(1), + CACHED_LAYOUT(2), + CACHED_MEASURE(3); + + public companion object { + @JvmStatic + public fun fromInt(value: Int): YogaLayoutType = + when (value) { + 0 -> LAYOUT + 1 -> MEASURE + 2 -> CACHED_LAYOUT + 3 -> CACHED_MEASURE + else -> throw IllegalArgumentException("Unknown enum value: $value") + } + } +}