-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use compatible mode enum (#19)
- Loading branch information
Showing
5 changed files
with
47 additions
and
23 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...nbase/src/main/java/com/oceanbase/connector/flink/connection/OceanBaseCompatibleMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2023 OceanBase | ||
* flink-connector-oceanbase is licensed under Mulan PSL v2. | ||
* You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
* You may obtain a copy of Mulan PSL v2 at: | ||
* http:https://license.coscl.org.cn/MulanPSL2 | ||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
* See the Mulan PSL v2 for more details. | ||
*/ | ||
|
||
package com.oceanbase.connector.flink.connection; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
public enum OceanBaseCompatibleMode { | ||
MYSQL, | ||
ORACLE; | ||
|
||
public static OceanBaseCompatibleMode fromString(String text) { | ||
if (StringUtils.isBlank(text)) { | ||
throw new IllegalArgumentException("Compatible mode should not be blank"); | ||
} | ||
switch (text.trim().toUpperCase()) { | ||
case "MYSQL": | ||
return MYSQL; | ||
case "ORACLE": | ||
return ORACLE; | ||
default: | ||
throw new UnsupportedOperationException("Unsupported compatible mode: " + text); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters