-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove deprecated StringUtils from commons
Signed-off-by: azerr <[email protected]>
- Loading branch information
1 parent
73f29eb
commit 52d82de
Showing
7 changed files
with
196 additions
and
137 deletions.
There are no files selected for viewing
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
63 changes: 63 additions & 0 deletions
63
src/main/java/com/redhat/devtools/intellij/lsp4ij/internal/StringUtils.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,63 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat Inc. and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package com.redhat.devtools.intellij.lsp4ij.internal; | ||
|
||
public class StringUtils { | ||
|
||
/** | ||
* Copied from https://github.com/apache/commons-lang/blob/24744a40b2c094945e542b71cc1fbf59caa0d70b/src/main/java/org/apache/commons/lang3/StringUtils.java#L3596C5-L3598C6 | ||
* | ||
* @param cs | ||
* @return | ||
*/ | ||
public static boolean isEmpty(final CharSequence cs) { | ||
return cs == null || cs.length() == 0; | ||
} | ||
|
||
/** | ||
* Copied code from https://github.com/apache/commons-lang/blob/24744a40b2c094945e542b71cc1fbf59caa0d70b/src/main/java/org/apache/commons/lang3/StringUtils.java#L3714C5-L3716C6 | ||
* @param cs | ||
* @return | ||
*/ | ||
public static boolean isNotBlank(final CharSequence cs) { | ||
return !isBlank(cs); | ||
} | ||
|
||
/** | ||
* Copied code from https://github.com/apache/commons-lang/blob/24744a40b2c094945e542b71cc1fbf59caa0d70b/src/main/java/org/apache/commons/lang3/StringUtils.java#L3564 | ||
* @param cs | ||
* @return | ||
*/ | ||
public static boolean isBlank(final CharSequence cs) { | ||
final int strLen = length(cs); | ||
if (strLen == 0) { | ||
return true; | ||
} | ||
for (int i = 0; i < strLen; i++) { | ||
if (!Character.isWhitespace(cs.charAt(i))) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
/** | ||
* Copied code from https://github.com/apache/commons-lang/blob/24744a40b2c094945e542b71cc1fbf59caa0d70b/src/main/java/org/apache/commons/lang3/StringUtils.java#L5281 | ||
* @param cs | ||
* @return | ||
*/ | ||
public static int length(final CharSequence cs) { | ||
return cs == null ? 0 : cs.length(); | ||
} | ||
} |
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
Oops, something went wrong.