Skip to content

Commit

Permalink
[Bug] [dinky-common] Fix deserialization exceptions caused by incorre…
Browse files Browse the repository at this point in the history
…ct get methods in enum fields. (#4082)
  • Loading branch information
Jam804 authored Dec 24, 2024
1 parent 0f14777 commit 91af61a
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions dinky-common/src/main/java/org/dinky/data/enums/GatewayType.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@

import org.dinky.assertion.Asserts;

import lombok.Getter;

/**
* SubmitType
*
* @since 2021/10/29
*/
@Getter
public enum GatewayType {
LOCAL("l", "local"),
STANDALONE("s", "standalone"),
Expand All @@ -44,30 +47,17 @@ public enum GatewayType {
this.longValue = longValue;
}

public String getValue() {
return value;
}

public String getLongValue() {
return longValue;
}

public static GatewayType get(String value) {
for (GatewayType type : GatewayType.values()) {
if (Asserts.isEquals(type.getValue(), value) || Asserts.isEquals(type.getLongValue(), value)) {
if (Asserts.isEquals(type.getValue(), value)
|| Asserts.isEquals(type.getLongValue(), value)
|| Asserts.isEquals(type.toString(), value)) {
return type;
}
}
return GatewayType.LOCAL;
}

public static GatewayType getSessionType(String value) {
if (value.contains("kubernetes")) {
return GatewayType.KUBERNETES_SESSION;
}
return GatewayType.YARN_SESSION;
}

public GatewayType getSessionType() {
if (longValue.contains("kubernetes")) {
return GatewayType.KUBERNETES_SESSION;
Expand Down

0 comments on commit 91af61a

Please sign in to comment.