Skip to content

Make builders and static ctors consistent #1596

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

Merged
merged 1 commit into from
Jan 24, 2020
Merged

Conversation

dagnir
Copy link
Contributor

@dagnir dagnir commented Jan 17, 2020

Description

Make builders and static ctors consistent. Also removed the builder() methods from interfaces.

Motivation and Context

Consistent with the rest of the SDK and the our standards: https://github.com/aws/aws-sdk-java-v2/blob/master/docs/design/FavorStaticFactoryMethods.md#favor-static-factory-methods-over-constructors

Testing

mvn clean install -pl :dynamodb-enhanced -am

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • x ] I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed
  • A short description of the change has been added to the CHANGELOG
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@dagnir dagnir requested a review from bmaizels January 17, 2020 18:40
StaticTableSchema.builder()
.newItemSupplier(Record::new)
.attributes(
fromString("id", Record::getId, Record::setId).as(primaryPartitionKey()),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to have some discussion about whether this is semantically correct and what standard we should use here. Not necessarily disagreeing, just keeping this comment as a placeholder to make sure that discussion happens offline.

@@ -52,7 +52,7 @@ public void generateTransactWriteItem() {
.expressionValues(singletonMap("key2", stringValue("value2")))
.build();
ConditionCheck<FakeItem> operation =
ConditionCheck.of(Key.of(stringValue(fakeItem.getId())), conditionExpression);
ConditionCheck.create(Key.of(stringValue(fakeItem.getId())), conditionExpression);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be Key.create?

@codecov-io
Copy link

codecov-io commented Jan 23, 2020

Codecov Report

Merging #1596 into master will increase coverage by <.01%.
The diff coverage is 96%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1596      +/-   ##
============================================
+ Coverage      75.7%   75.71%   +<.01%     
+ Complexity      684      682       -2     
============================================
  Files           907      905       -2     
  Lines         28385    28383       -2     
  Branches       2255     2255              
============================================
+ Hits          21488    21489       +1     
+ Misses         5876     5875       -1     
+ Partials       1021     1019       -2
Flag Coverage Δ Complexity Δ
#unittests 75.71% <96%> (ø) 682 <41> (-2) ⬇️
Impacted Files Coverage Δ Complexity Δ
...mappingclient/extensions/ChainMapperExtension.java 100% <ø> (ø) 12 <0> (ø) ⬇️
...sions/dynamodb/mappingclient/operations/Query.java 56.79% <ø> (ø) 10 <0> (ø) ⬇️
...s/dynamodb/mappingclient/operations/ReadBatch.java 55% <ø> (ø) 13 <0> (ø) ⬇️
...ons/dynamodb/mappingclient/operations/GetItem.java 70.73% <ø> (ø) 11 <0> (ø) ⬇️
.../dynamodb/mappingclient/operations/UpdateItem.java 84.49% <ø> (ø) 34 <0> (ø) ⬇️
...amodb/mappingclient/operations/ConditionCheck.java 41.66% <ø> (ø) 3 <0> (ø) ⬇️
.../dynamodb/mappingclient/operations/DeleteItem.java 78.43% <ø> (ø) 11 <0> (ø) ⬇️
...mappingclient/operations/GlobalSecondaryIndex.java 29.03% <ø> (ø) 5 <0> (ø) ⬇️
...ons/dynamodb/mappingclient/operations/PutItem.java 80.88% <ø> (ø) 19 <0> (ø) ⬇️
...awssdk/extensions/dynamodb/mappingclient/Page.java 42.1% <ø> (ø) 5 <0> (ø) ⬇️
... and 24 more

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 c0ba291...6272280. Read the comment docs.

Copy link
Contributor

@bmaizels bmaizels left a comment

Choose a reason for hiding this comment

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

I think it looks good. Just one non-blocking thing, I do think the asString etc. is better than fromString or the original string, but I wonder if this is something we should just take a quick moment to poll the team and vote on a few alternatives and see if anyone has an even better idea.

@dagnir
Copy link
Contributor Author

dagnir commented Jan 23, 2020

@bmaizels Sure will do

@dagnir dagnir merged commit 0deaff0 into aws:master Jan 24, 2020
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

aws-sdk-java-automation added a commit that referenced this pull request Aug 9, 2021
…c8b8c8d9d

Pull request: release <- staging/2a71d721-9cc1-4cb0-a733-a6ec8b8c8d9d
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.

3 participants