-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Use static PropertyNamingStrategy instances in POJOPropertiesCollector._findNamingStrategy() #4109
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
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 |
---|---|---|
|
@@ -1450,6 +1450,50 @@ private PropertyNamingStrategy _findNamingStrategy() | |
return pns; | ||
} | ||
} | ||
|
||
// PropertyNamingStrategy | ||
if (namingClass == PropertyNamingStrategy.SnakeCaseStrategy.class) { | ||
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. can this list of 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. As far as I know the baseline version Java 8 doesn't support switch for 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. If we were to do this, I think switch logic should be moved into a static method of 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. Moved switching logic to |
||
return PropertyNamingStrategies.SNAKE_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategy.UpperCamelCaseStrategy.class) { | ||
return PropertyNamingStrategies.UPPER_CAMEL_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategy.KebabCaseStrategy.class) { | ||
return PropertyNamingStrategies.KEBAB_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategy.LowerDotCaseStrategy.class) { | ||
return PropertyNamingStrategies.LOWER_DOT_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy.class) { | ||
return PropertyNamingStrategies.SNAKE_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategy.PascalCaseStrategy.class) { | ||
return PropertyNamingStrategies.UPPER_CAMEL_CASE; | ||
} | ||
|
||
// PropertyNamingStrategies | ||
if (namingClass == PropertyNamingStrategies.SnakeCaseStrategy.class) { | ||
return PropertyNamingStrategies.SNAKE_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategies.UpperSnakeCaseStrategy.class) { | ||
return PropertyNamingStrategies.UPPER_SNAKE_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategies.LowerCamelCaseStrategy.class) { | ||
return PropertyNamingStrategies.LOWER_CAMEL_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategies.UpperCamelCaseStrategy.class) { | ||
return PropertyNamingStrategies.UPPER_CAMEL_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategies.LowerCaseStrategy.class) { | ||
return PropertyNamingStrategies.LOWER_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategies.KebabCaseStrategy.class) { | ||
return PropertyNamingStrategies.KEBAB_CASE; | ||
} | ||
if (namingClass == PropertyNamingStrategies.LowerDotCaseStrategy.class) { | ||
return PropertyNamingStrategies.LOWER_DOT_CASE; | ||
} | ||
|
||
return (PropertyNamingStrategy) ClassUtil.createInstance(namingClass, | ||
_config.canOverrideAccessModifiers()); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly, at line 1448 (above)
HandlerInstantiator
is also doing what we are trying to prevent to happen here.namingStrategyInstance()
JavaDoc says....Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HandlerInstantiator
is given through configuration and it can return any instance ofPropertyNamingStrategy
. I think we can't rescue ifHandlerInstantiator
is used.