-
Notifications
You must be signed in to change notification settings - Fork 20
chore: bump org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0 in /dependency-bundles/bom #857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
bf4dc52
5b903ed
687d71e
c588eac
3766616
0ecbe69
cc79504
631f0b4
999d8d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.sap.cloud.sdk.datamodel.odata.utility; | ||
|
||
import java.util.Collection; | ||
import java.util.Locale; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
@@ -120,8 +121,8 @@ public String generateJavaMethodName( @Nonnull final String name ) | |
methodName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName); | ||
methodName = appendSuffixIfNameIsReservedKeyword(methodName, "Objects"); | ||
|
||
methodName = StringUtils.removeStart(methodName, "to"); | ||
methodName = StringUtils.removeStart(methodName, "_"); | ||
methodName = removeStartIgnoreCase(methodName, "to"); | ||
methodName = removeStartIgnoreCase(methodName, "_"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately we cannot use the suggested new method, since they have just been introduced with their latest update. That means any "updated" / non-deprecated API would risk a runtime exceptions for users who still use an older version of Options have been:
|
||
methodName = NamingUtils.uncapitalize(methodName); | ||
|
||
throwIfConversionResultIsNullOrEmpty(name, null, methodName, "Java method name"); | ||
|
@@ -134,8 +135,8 @@ public String generateJavaMethodName( @Nonnull final String name ) | |
public String generateJavaBuilderMethodName( @Nonnull final String name ) | ||
{ | ||
String methodName = generateNameFromProperty(name, null); | ||
methodName = StringUtils.removeStartIgnoreCase(methodName, "to"); | ||
methodName = StringUtils.removeStart(methodName, "_"); | ||
methodName = removeStartIgnoreCase(methodName, "to"); | ||
methodName = removeStartIgnoreCase(methodName, "_"); | ||
methodName = uncapitalizeLeadingAcronym(methodName); | ||
methodName = appendSuffixIfNameIsReservedKeyword(methodName, "Property"); | ||
|
||
|
@@ -152,8 +153,8 @@ public String generateJavaOperationMethodName( @Nonnull final String name, @Null | |
methodName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName); | ||
methodName = appendSuffixIfNameIsReservedKeyword(methodName, "Function"); | ||
|
||
methodName = StringUtils.removeStart(methodName, "to"); | ||
methodName = StringUtils.removeStart(methodName, "_"); | ||
methodName = removeStartIgnoreCase(methodName, "to"); | ||
methodName = removeStartIgnoreCase(methodName, "_"); | ||
|
||
throwIfConversionResultIsNullOrEmpty(name, label, methodName, "Java function import method name"); | ||
|
||
|
@@ -250,7 +251,7 @@ private String removeFirstPrefix( final String name, final Iterable<String> pref | |
{ | ||
String formattedName = name.trim(); | ||
for( final String prefixToRemove : prefixes ) { | ||
if( StringUtils.startsWith(formattedName, prefixToRemove) ) { | ||
if( formattedName.startsWith(prefixToRemove) ) { | ||
formattedName = formattedName.substring(prefixToRemove.length()); | ||
break; | ||
} | ||
|
@@ -262,9 +263,27 @@ private String removeAllSuffixes( @Nonnull final String name, @Nonnull final Ite | |
{ | ||
String formattedName = name; | ||
for( final String suffix : suffixes ) { | ||
formattedName = StringUtils.removeEndIgnoreCase(formattedName, suffix); | ||
formattedName = removeEndIgnoreCase(formattedName, suffix); | ||
} | ||
|
||
return formattedName; | ||
} | ||
|
||
@Nonnull | ||
private static String removeStartIgnoreCase( @Nonnull final String s, @Nonnull final String prefix ) | ||
{ | ||
if( s.toLowerCase(Locale.ROOT).startsWith(prefix.toLowerCase(Locale.ROOT)) ) { | ||
return s.substring(prefix.length()); | ||
} | ||
return s; | ||
} | ||
|
||
@Nonnull | ||
private static String removeEndIgnoreCase( @Nonnull final String s, @Nonnull final String prefix ) | ||
{ | ||
if( s.toLowerCase(Locale.ROOT).endsWith(prefix.toLowerCase(Locale.ROOT)) ) { | ||
return s.substring(0, s.length() - prefix.length()); | ||
} | ||
return s; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.