Skip to content

Commit 5d5350b

Browse files
cortinicometa-codesync[bot]
authored andcommitted
Migrate YogaLogLevel enum to Kotlin (#56794)
Summary: X-link: react/yoga#1943 Pull Request resolved: #56794 Migrate YogaLogLevel.java to YogaLogLevel.kt by adding LogLevel to KOTLIN_ENUM_NAMES in enums.py and regenerating. Also adds DO_NOT_STRIP support to the Kotlin codegen path to preserve the DoNotStrip annotation. Reviewed By: fabriziocucci Differential Revision: D104666343 fbshipit-source-id: 6307e0f72559d505a8db115d63669271cbd8754a
1 parent 084a776 commit 5d5350b

2 files changed

Lines changed: 39 additions & 45 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// @generated by enums.py
9+
10+
package com.facebook.yoga
11+
12+
import com.facebook.yoga.annotations.DoNotStrip
13+
14+
@DoNotStrip
15+
public enum class YogaLogLevel(public val intValue: Int) {
16+
ERROR(0),
17+
WARN(1),
18+
INFO(2),
19+
DEBUG(3),
20+
VERBOSE(4),
21+
FATAL(5);
22+
23+
public fun intValue(): Int = intValue
24+
25+
public companion object {
26+
@DoNotStrip
27+
@JvmStatic
28+
public fun fromInt(value: Int): YogaLogLevel =
29+
when (value) {
30+
0 -> ERROR
31+
1 -> WARN
32+
2 -> INFO
33+
3 -> DEBUG
34+
4 -> VERBOSE
35+
5 -> FATAL
36+
else -> throw IllegalArgumentException("Unknown enum value: $value")
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)