Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
a16aa767
Commit
a16aa767
authored
Aug 22, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak performance of RelaxedNames.separatedToCamelCase
Closes gh-6661
parent
53374ec5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
RelaxedNames.java
...main/java/org/springframework/boot/bind/RelaxedNames.java
+9
-3
No files found.
spring-boot/src/main/java/org/springframework/boot/bind/RelaxedNames.java
View file @
a16aa767
...
...
@@ -200,23 +200,29 @@ public final class RelaxedNames implements Iterable<String> {
};
private
static
final
char
[]
SUFFIXES
=
new
char
[]
{
'_'
,
'-'
,
'.'
};
public
abstract
String
apply
(
String
value
);
private
static
String
separatedToCamelCase
(
String
value
,
boolean
caseInsensitive
)
{
if
(
value
.
length
()
==
0
)
{
return
value
;
}
StringBuilder
builder
=
new
StringBuilder
();
for
(
String
field
:
SEPARATED_TO_CAMEL_CASE_PATTERN
.
split
(
value
))
{
field
=
(
caseInsensitive
?
field
.
toLowerCase
()
:
field
);
builder
.
append
(
builder
.
length
()
==
0
?
field
:
StringUtils
.
capitalize
(
field
));
}
for
(
String
suffix
:
new
String
[]
{
"_"
,
"-"
,
"."
})
{
if
(
value
.
endsWith
(
suffix
))
{
char
lastChar
=
value
.
charAt
(
value
.
length
()
-
1
);
for
(
char
suffix
:
SUFFIXES
)
{
if
(
lastChar
==
suffix
)
{
builder
.
append
(
suffix
);
break
;
}
}
return
builder
.
toString
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment