Commit 561f235 1 parent a3aa6c2 commit 561f235 Copy full SHA for 561f235
File tree 2 files changed +32
-10
lines changed
reactive-crypto-core/src/main/kotlin/com/njkim/reactivecrypto/core/common
2 files changed +32
-10
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package com.njkim.reactivecrypto.core.common.model
18
18
19
- import org.apache.commons.lang3.text.WordUtils
19
+ import com.njkim.reactivecrypto.core.common.util.toCarmelCase
20
20
21
21
enum class ExchangeVendor {
22
22
UPBIT ,
@@ -37,11 +37,10 @@ enum class ExchangeVendor {
37
37
val websocketClientName: String
38
38
get() {
39
39
val packageName = this .name.toLowerCase().replace(" _" , " " )
40
- val carmelCaseName = WordUtils
41
- .capitalizeFully(this .name, ' _' )
42
- .replace(" _" , " " )
40
+ val className = this .name.toCarmelCase()
41
+ .capitalize()
43
42
44
- return " com.njkim.reactivecrypto.$packageName .${carmelCaseName } WebsocketClient"
43
+ return " com.njkim.reactivecrypto.$packageName .${className } WebsocketClient"
45
44
}
46
45
47
46
/* *
@@ -50,10 +49,9 @@ enum class ExchangeVendor {
50
49
val httpClientName: String
51
50
get() {
52
51
val packageName = this .name.toLowerCase().replace(" _" , " " )
53
- val carmelCaseName = WordUtils
54
- .capitalizeFully(this .name, ' _' )
55
- .replace(" _" , " " )
52
+ val className = this .name.toCarmelCase()
53
+ .capitalize()
56
54
57
- return " com.njkim.reactivecrypto.$packageName .http.${carmelCaseName } HttpClient"
55
+ return " com.njkim.reactivecrypto.$packageName .http.${className } HttpClient"
58
56
}
59
- }
57
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2019 namjug-kim
3
+ *
4
+ * LINE Corporation licenses this file to you under the Apache License,
5
+ * version 2.0 (the "License"); you may not use this file except in compliance
6
+ * with the License. You may obtain a copy of the License at:
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ * License for the specific language governing permissions and limitations
14
+ * under the License.
15
+ */
16
+
17
+ package com.njkim.reactivecrypto.core.common.util
18
+
19
+ val snakeCaseRegex = Regex (" (_)([a-z])" )
20
+
21
+ fun String.toCarmelCase (): String {
22
+ return this .toLowerCase()
23
+ .replace(snakeCaseRegex) { matchResult -> matchResult.groupValues[2 ].toUpperCase() }
24
+ }
You can’t perform that action at this time.
0 commit comments