diff --git a/spring-core/src/main/java/org/springframework/core/convert/support/StringToRegexConverter.java b/spring-core/src/main/java/org/springframework/core/convert/support/StringToRegexConverter.java new file mode 100644 index 0000000000..6092ec3582 --- /dev/null +++ b/spring-core/src/main/java/org/springframework/core/convert/support/StringToRegexConverter.java @@ -0,0 +1,39 @@ +/* + * Copyright 2002-2022 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.core.convert.support; + +import kotlin.text.Regex; + +import org.springframework.core.convert.converter.Converter; + +/** + * Converts from a String to a {@link Regex}. + * + * @author Stephane Nicoll + * @author Sebastien Deleuze + */ +class StringToRegexConverter implements Converter { + + @Override + public Regex convert(String source) { + if (source.isEmpty()) { + return null; + } + return new Regex(source); + } + +} diff --git a/spring-core/src/main/kotlin/org/springframework/core/convert/support/StringToRegexConverter.kt b/spring-core/src/main/kotlin/org/springframework/core/convert/support/StringToRegexConverter.kt deleted file mode 100644 index 790dc99422..0000000000 --- a/spring-core/src/main/kotlin/org/springframework/core/convert/support/StringToRegexConverter.kt +++ /dev/null @@ -1,19 +0,0 @@ -package org.springframework.core.convert.support - -import org.springframework.core.convert.converter.Converter - -/** - * Converts from a String to a [Regex]. - * - * @author Stephane Nicoll - */ -class StringToRegexConverter : Converter { - - override fun convert(source: String): Regex? { - if (source.isEmpty()) { - return null - } - return source.toRegex() - } - -} \ No newline at end of file