Skip to content

Commit 561f235

Browse files
committed
reactor: remove deprecated WordUtils
1 parent a3aa6c2 commit 561f235

File tree

2 files changed

+32
-10
lines changed

2 files changed

+32
-10
lines changed

reactive-crypto-core/src/main/kotlin/com/njkim/reactivecrypto/core/common/model/ExchangeVendor.kt

+8-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package com.njkim.reactivecrypto.core.common.model
1818

19-
import org.apache.commons.lang3.text.WordUtils
19+
import com.njkim.reactivecrypto.core.common.util.toCarmelCase
2020

2121
enum class ExchangeVendor {
2222
UPBIT,
@@ -37,11 +37,10 @@ enum class ExchangeVendor {
3737
val websocketClientName: String
3838
get() {
3939
val packageName = this.name.toLowerCase().replace("_", "")
40-
val carmelCaseName = WordUtils
41-
.capitalizeFully(this.name, '_')
42-
.replace("_", "")
40+
val className = this.name.toCarmelCase()
41+
.capitalize()
4342

44-
return "com.njkim.reactivecrypto.$packageName.${carmelCaseName}WebsocketClient"
43+
return "com.njkim.reactivecrypto.$packageName.${className}WebsocketClient"
4544
}
4645

4746
/**
@@ -50,10 +49,9 @@ enum class ExchangeVendor {
5049
val httpClientName: String
5150
get() {
5251
val packageName = this.name.toLowerCase().replace("_", "")
53-
val carmelCaseName = WordUtils
54-
.capitalizeFully(this.name, '_')
55-
.replace("_", "")
52+
val className = this.name.toCarmelCase()
53+
.capitalize()
5654

57-
return "com.njkim.reactivecrypto.$packageName.http.${carmelCaseName}HttpClient"
55+
return "com.njkim.reactivecrypto.$packageName.http.${className}HttpClient"
5856
}
59-
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
}

0 commit comments

Comments
 (0)