Refactor primitive type fields to be of object type in JSON objects#313
Refactor primitive type fields to be of object type in JSON objects#313marcuslinke merged 12 commits intomasterfrom
Conversation
|
@marcuslinke my thoughts:
|
|
@KostyaSha Thanks for the review! Yes, I initially did search and replace for booleans, so I need to review all of these replacements. I like your suggestions especially that it will retain backward compatibility. However, it will take some time as I'm quite busy with other things at the moment. |
|
@marcuslinke my suggestion will be to start doing it partially. I can start with critical for docker-plugin API commands and PR changes. @marcuslinke btw, backward compatibility will be broken in any release because all methods defined in interface that requires extending fields/methods for every docker API update. So it seems that we should forget about compatibilities in X.Y. |
Conflicts: src/main/java/com/github/dockerjava/api/command/LogContainerCmd.java src/main/java/com/github/dockerjava/api/model/BuildResponseItem.java src/main/java/com/github/dockerjava/api/model/PullResponseItem.java src/main/java/com/github/dockerjava/api/model/PushResponseItem.java src/main/java/com/github/dockerjava/api/model/ResponseItem.java src/main/java/com/github/dockerjava/core/command/LogContainerCmdImpl.java src/main/java/com/github/dockerjava/jaxrs/LogContainerCmdExec.java
|
@KostyaSha After thinking about it again I want to discuss these additional get/has/is methods that return primitives (in commands):
|
|
Maybe attach to request only non-null values without checking what is default plus annotate everything with |
|
OK, so lets summarize:
Do you agree? |
|
Sounds good |
|
My idea about removing |
|
Yeah. I will probably remove this also. By the way, according to http://ehc.ac/p/findbugs/bugs/334/ |
|
Right, for method return values inheritance should work. |
|
@marcuslinke and if we do refactoring, is it possible to use Lists instead arrays? |
|
@KostyaSha I think we could add additional methods that takes |
|
Disclaimer: i'm not an expert of api libraries :) |
|
According to google this code should work Then you can simply use some http://commons.apache.org/proper/commons-collections/javadocs/api-3.2.1/org/apache/commons/collections/CollectionUtils.html#isNotEmpty(java.util.Collection) or guava... |
|
I think the main difference between arrays and lists is the aspect of mutablitity. Whereas arrays are immutable, lists in contast are not and allow the manipulation from the outside. In general I dont think this is a good idea as it may result in unexpected behaviour. So switching to lists would enforce to ensure the immutablitity by copying to (when implementing the setter) and copying from (when implementing the getter) the internal list. I would avoid this implementation effort... |
|
Where do you see mutability issue? You can either replace List either manipulate with existed. During exec it will be send to remote. |
Conflicts: src/main/java/com/github/dockerjava/api/command/CreateContainerCmd.java src/main/java/com/github/dockerjava/api/model/HostConfig.java src/main/java/com/github/dockerjava/core/command/CreateContainerCmdImpl.java
Refactor primitive type fields to be of object type in JSON objects
No description provided.