Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

#1203: Modified AbstractPrefField interface to include generic get and put methods.#1272

Merged
WonderCsabo merged 1 commit into
androidannotations:developandroidannotations/androidannotations:developfrom
chvndb:1203-Generic_AbstractPrefFieldCopy head branch name to clipboard
Jan 9, 2015
Merged

#1203: Modified AbstractPrefField interface to include generic get and put methods.#1272
WonderCsabo merged 1 commit into
androidannotations:developandroidannotations/androidannotations:developfrom
chvndb:1203-Generic_AbstractPrefFieldCopy head branch name to clipboard

Conversation

@chvndb

@chvndb chvndb commented Dec 10, 2014

Copy link
Copy Markdown
Contributor

Relates to #1203

@WonderCsabo

Copy link
Copy Markdown
Member

Why did you close the previous PR? You could overwrite the branch with git push -f.

@dodgex

dodgex commented Dec 10, 2014

Copy link
Copy Markdown
Member

i think because he had a wrong branch name there. the other was 203-Generic_AbstractPrefField instead of 1203. or does git/github support branch renaming for a PR?

@dodgex

dodgex commented Dec 10, 2014

Copy link
Copy Markdown
Member

@chvndb you should add @Override annotations.

@chvndb

chvndb commented Dec 10, 2014

Copy link
Copy Markdown
Contributor Author

Indeed, the branch name was incorrect. I added @Override annotations.

@WonderCsabo

Copy link
Copy Markdown
Member

OK, branch renaming is not supported I think. I'll review this later.

@WonderCsabo

Copy link
Copy Markdown
Member

What happens if one passes null? I think that will yield NPE while unboxing.

@chvndb

chvndb commented Dec 10, 2014

Copy link
Copy Markdown
Contributor Author

Ah indeed, we had this discussion before and I forgot about it. We agreed on setting the preference to its default value. I will add this.

@chvndb

chvndb commented Dec 11, 2014

Copy link
Copy Markdown
Contributor Author

something like this?

@WonderCsabo

Copy link
Copy Markdown
Member

I do not think so. I think we agreed on to add zero if one passes null etc.

@chvndb

chvndb commented Dec 11, 2014

Copy link
Copy Markdown
Contributor Author

re-reading the original issue, it is ambiguous what the action should be when passing null. What do you actually mean by adding zero?

@WonderCsabo

Copy link
Copy Markdown
Member
if (value == null) {
  putLong(0);
}

etc

@chvndb

chvndb commented Dec 11, 2014

Copy link
Copy Markdown
Contributor Author

I see, so you would set the preference to what you consider to be the default value for the given type. I think it is more logical to set it to the default value the developer has defined, as he has thought about what the default value should be in the context of his application.

@WonderCsabo

Copy link
Copy Markdown
Member

Maybe you are right, but i am not really sure what would be better. @yDelouis WDYT?

@chvndb

chvndb commented Dec 11, 2014

Copy link
Copy Markdown
Contributor Author

E.g. storing a json object in a string preference and the default value is {"name":"chvndb"}. Using put(null) in the first case would set it to the empty string. However, this will most likely break the application while resetting it to the original will not.

@yDelouis

Copy link
Copy Markdown
Contributor

I think chvndb is right, we should reset the value to the default one.
Setting a value to null in a preference is restoring the default value for it. So, in our case, we should do the same.

@WonderCsabo

Copy link
Copy Markdown
Member

@chvndb please modify the null behavior as @yDelouis suggested. Also the reset() method is not needed in that case, i think. Also please squash your commits into one.

@chvndb

chvndb commented Dec 16, 2014

Copy link
Copy Markdown
Contributor Author

Added the null behaviour to reset the preference to the user defined default.

Added the reset method as it is a cleaner API. It allows a user to explicitly reset a given preference without using the side effect of putting a null value. I can still remove it if you want.

(p.s. squashed the commits)

@WonderCsabo

Copy link
Copy Markdown
Member

I think the reset() method is redundant. We already have the remove() method, and after that get() returns the default value.

@WonderCsabo

Copy link
Copy Markdown
Member

Thanks! Can you reword the commit as to follow the standard git format (as laid out in the contribution guide)?

@chvndb

chvndb commented Dec 22, 2014

Copy link
Copy Markdown
Contributor Author

Like this?

@WonderCsabo

Copy link
Copy Markdown
Member

Yeah, thanks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

final?

@WonderCsabo

Copy link
Copy Markdown
Member

@chvndb can you you please react to the review comments?

Write null to preference resets the preference to the user defined default value.
@chvndb

chvndb commented Jan 8, 2015

Copy link
Copy Markdown
Contributor Author

Sorry, with the new year I guess I missed your comments. Updated.

On 08 Jan 2015, at 13:26, Csaba Kozák notifications@github.com wrote:

@chvndb https://github.com/chvndb can you you please react to the review comments?


Reply to this email directly or view it on GitHub #1272 (comment).

WonderCsabo added a commit that referenced this pull request Jan 9, 2015
#1203: Modified AbstractPrefField interface to include generic get and put methods.
@WonderCsabo WonderCsabo merged commit eabff92 into androidannotations:develop Jan 9, 2015
@WonderCsabo

Copy link
Copy Markdown
Member

Thanks!

@WonderCsabo WonderCsabo added this to the 3.3 milestone Apr 30, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.