mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Migrate YogaLogLevel enum to Kotlin (#56794)
Summary: X-link: https://github.com/facebook/yoga/pull/1943 Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
1 parent
084a77631f
commit
5d5350b1e4
2 files changed
+39
-45
No files matched your search
@@ -1,45 +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.
|
||||
*/
|
||||
|
||||
// @generated by enums.py
|
||||
|
||||
package com.facebook.yoga;
|
||||
|
||||
import com.facebook.yoga.annotations.DoNotStrip;
|
||||
|
||||
@DoNotStrip
|
||||
public enum YogaLogLevel {
|
||||
ERROR(0),
|
||||
WARN(1),
|
||||
INFO(2),
|
||||
DEBUG(3),
|
||||
VERBOSE(4),
|
||||
FATAL(5);
|
||||
|
||||
private final int mIntValue;
|
||||
|
||||
YogaLogLevel(int intValue) {
|
||||
mIntValue = intValue;
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return mIntValue;
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
public static YogaLogLevel fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return ERROR;
|
||||
case 1: return WARN;
|
||||
case 2: return INFO;
|
||||
case 3: return DEBUG;
|
||||
case 4: return VERBOSE;
|
||||
case 5: return FATAL;
|
||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// @generated by enums.py
|
||||
|
||||
package com.facebook.yoga
|
||||
|
||||
import com.facebook.yoga.annotations.DoNotStrip
|
||||
|
||||
@DoNotStrip
|
||||
public enum class YogaLogLevel(public val intValue: Int) {
|
||||
ERROR(0),
|
||||
WARN(1),
|
||||
INFO(2),
|
||||
DEBUG(3),
|
||||
VERBOSE(4),
|
||||
FATAL(5);
|
||||
|
||||
public fun intValue(): Int = intValue
|
||||
|
||||
public companion object {
|
||||
@DoNotStrip
|
||||
@JvmStatic
|
||||
public fun fromInt(value: Int): YogaLogLevel =
|
||||
when (value) {
|
||||
0 -> ERROR
|
||||
1 -> WARN
|
||||
2 -> INFO
|
||||
3 -> DEBUG
|
||||
4 -> VERBOSE
|
||||
5 -> FATAL
|
||||
else -> throw IllegalArgumentException("Unknown enum value: $value")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user