Skip to content
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

issue 71: reading from java beans #81

Merged
merged 13 commits into from
Sep 12, 2018

Conversation

kmikulski
Copy link
Contributor

No description provided.

t.decls.collect {
case m: MethodSymbol if m.isGetter =>
case m: MethodSymbol if (m.paramLists.isEmpty || m.paramLists == List(List())) && !m.isPrivate =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!m.isPrivate should be m.isPublic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is also changed in #76 in order for one test to pass. Whichever PR comes first, please keep their behavior (can be factored out to a separate method of course).

if(config.disableBeanGetterLookup) {
sourceName == fieldName
} else {
sourceName == fieldName || sourceName == s"get$targetNameCapitalized" || sourceName == s"is$targetNameCapitalized"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder if we should check also source type for isXXX patterns, allowing only Booleans

but not necessarily in this PR

@krzemin
Copy link
Member

krzemin commented Sep 9, 2018

Also, please remember about running scalafmt before comitting - otherwise travis build will fail.

# Conflicts:
#	chimney/src/main/scala/io/scalaland/chimney/dsl.scala
#	chimney/src/main/scala/io/scalaland/chimney/internal/DslBlackboxMacros.scala
#	chimney/src/main/scala/io/scalaland/chimney/internal/MacroUtils.scala
#	chimney/src/test/scala/io/scalaland/chimney/DslSpec.scala
@codecov-io
Copy link

codecov-io commented Sep 10, 2018

Codecov Report

Merging #81 into master will increase coverage by 0.26%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #81      +/-   ##
==========================================
+ Coverage   92.25%   92.51%   +0.26%     
==========================================
  Files           7        7              
  Lines         284      294      +10     
  Branches       62       59       -3     
==========================================
+ Hits          262      272      +10     
  Misses         22       22
Impacted Files Coverage Δ
.../scalaland/chimney/internal/DerivationConfig.scala 100% <ø> (ø) ⬆️
...ala/io/scalaland/chimney/internal/MacroUtils.scala 100% <100%> (ø) ⬆️
...scalaland/chimney/internal/TransformerMacros.scala 88.35% <100%> (+0.31%) ⬆️
...mney/src/main/scala/io/scalaland/chimney/dsl.scala 100% <100%> (ø) ⬆️
...scalaland/chimney/internal/DslBlackboxMacros.scala 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad00f4a...2cd4c80. Read the comment docs.

@krzemin
Copy link
Member

krzemin commented Sep 10, 2018

Travis build failed due to code being not properly formatted. Please run scalafmt sbt task and push again.

@kmikulski
Copy link
Contributor Author

Addressed the comments in this PR, but Codacy is now complaining due to too many ifs in DslBlackboxMacros, and I don't really see a way of converting it to case matching due to the values being dynamic. Thoughts?

@krzemin
Copy link
Member

krzemin commented Sep 10, 2018

I think you can ignore Codacy - it was complaining for every such if-branch. Instead, I would focus on adding few more test cases to keep the coverage. At least:

  • case when the switch is disabled and we don't interpret bean naming conventions
  • case when a field named isXXX doesn't have Boolean type

Copy link
Member

@krzemin krzemin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome @kuba-mikulski, thank you!

@krzemin krzemin merged commit 0b82874 into master Sep 12, 2018
@krzemin krzemin deleted the feature/issue-71-reading-from-beans branch September 12, 2018 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants