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

Add all() and first() convenience methods and make save() overridable #424

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@tacoman667

tacoman667 commented Oct 20, 2015

Added convenience method for first() and all(). changed save() from final to overridable. Sometimes one might want to be able to wrap the save command with additional functionality, like logging, or creation of new relationship objects, etc.

added convenience method for first() and all(). changed save() from f…
…inal to overridable. Sometimes one might want to be able to wrap the save command with additional functionality, like logging, or creation of new relationship objects, etc.
@saulojg

This comment has been minimized.

Show comment
Hide comment
@saulojg

saulojg Oct 20, 2015

Sounds useful, though I've wondered for a while what were the motivations behind making these methods final. I wish they weren't final so that I could add beforeSave and afterSave callbacks on a few models (perhaps annotated with @CallSuper?).

saulojg commented Oct 20, 2015

Sounds useful, though I've wondered for a while what were the motivations behind making these methods final. I wish they weren't final so that I could add beforeSave and afterSave callbacks on a few models (perhaps annotated with @CallSuper?).

@tacoman667

This comment has been minimized.

Show comment
Hide comment
@tacoman667

tacoman667 Oct 20, 2015

Forgive me if I am not completely up to speed on Java. I am more versed in C#, Ruby, JavaScript, etc. Does @callsuper annotation make all overrides fail the compile step if the overridden method doesn't call super.overriddenMethod()?

Personally, I override save() on a few of my models so that I can add event logging for a business application. This was my motivation to open save() back up again and remove that final declaration.

tacoman667 commented Oct 20, 2015

Forgive me if I am not completely up to speed on Java. I am more versed in C#, Ruby, JavaScript, etc. Does @callsuper annotation make all overrides fail the compile step if the overridden method doesn't call super.overriddenMethod()?

Personally, I override save() on a few of my models so that I can add event logging for a business application. This was my motivation to open save() back up again and remove that final declaration.

@joshuapinter

This comment has been minimized.

Show comment
Hide comment
@joshuapinter

joshuapinter Mar 8, 2017

Contributor

@tacoman667 Hey, I like your additions. Any idea how I would easily include your fork? I'm used to npm and RubyGems right now so can't figure out this .jar and Maven stuff.

Contributor

joshuapinter commented Mar 8, 2017

@tacoman667 Hey, I like your additions. Any idea how I would easily include your fork? I'm used to npm and RubyGems right now so can't figure out this .jar and Maven stuff.

@tacoman667

This comment has been minimized.

Show comment
Hide comment
@tacoman667

tacoman667 Mar 8, 2017

@joshuapinter Unfortunately, you will have to build the jar or include the source into your project and reference it locally. That's what I did for my Android project. Our fork is at https://github.com/surgeforward/ActiveAndroid with these small changes in this PR or you can just add the few lines of code to your own fork.

tacoman667 commented Mar 8, 2017

@joshuapinter Unfortunately, you will have to build the jar or include the source into your project and reference it locally. That's what I did for my Android project. Our fork is at https://github.com/surgeforward/ActiveAndroid with these small changes in this PR or you can just add the few lines of code to your own fork.

@joshuapinter

This comment has been minimized.

Show comment
Hide comment
@joshuapinter

joshuapinter Mar 8, 2017

Contributor

@tacoman667 Thanks for the response. Yeah, I figured it's not as easy as updating the GitHub branch on a package.json file. :)

I had trouble building the .jar, likely because the Gradle build tools and config are so out of date so I'll try referencing the local project and see how that goes. Thanks.

Contributor

joshuapinter commented Mar 8, 2017

@tacoman667 Thanks for the response. Yeah, I figured it's not as easy as updating the GitHub branch on a package.json file. :)

I had trouble building the .jar, likely because the Gradle build tools and config are so out of date so I'll try referencing the local project and see how that goes. Thanks.

@joshuapinter

This comment has been minimized.

Show comment
Hide comment
@joshuapinter

joshuapinter Mar 8, 2017

Contributor

@tacoman667 Just an update, include the library and have everything working great, including your updates and some other things, like returning the saved object on save() instead of the object's id. Plus, now I can make super quick updates to the library without leaving my project and having to generate a .jar file. Definitely the way to go.

Contributor

joshuapinter commented Mar 8, 2017

@tacoman667 Just an update, include the library and have everything working great, including your updates and some other things, like returning the saved object on save() instead of the object's id. Plus, now I can make super quick updates to the library without leaving my project and having to generate a .jar file. Definitely the way to go.

@tacoman667

This comment has been minimized.

Show comment
Hide comment
@tacoman667

tacoman667 Mar 8, 2017

@joshuapinter Glad I could help! Sad that this project seems dead though. :(

TBH, I am more into RealmDB on mobile devices these days...

tacoman667 commented Mar 8, 2017

@joshuapinter Glad I could help! Sad that this project seems dead though. :(

TBH, I am more into RealmDB on mobile devices these days...

@joshuapinter

This comment has been minimized.

Show comment
Hide comment
@joshuapinter

joshuapinter Mar 8, 2017

Contributor

@tacoman667 Me too, actually. I use Realm (and their sync platform) for my side project, ntwrk. Cross platform, React Native with built-in sync. It's not perfect but it's pretty damn good and getting better all the time. Plus, no need for a ORM, its native methods are good enough.

We're still heavily engrained with ActiveAndroid on my work's mobile app and, to be fair, it's been great. However, will eventually migrate over to Realm as we convert things to React Native and consolidate our platform support.

Contributor

joshuapinter commented Mar 8, 2017

@tacoman667 Me too, actually. I use Realm (and their sync platform) for my side project, ntwrk. Cross platform, React Native with built-in sync. It's not perfect but it's pretty damn good and getting better all the time. Plus, no need for a ORM, its native methods are good enough.

We're still heavily engrained with ActiveAndroid on my work's mobile app and, to be fair, it's been great. However, will eventually migrate over to Realm as we convert things to React Native and consolidate our platform support.

@saulojg

This comment has been minimized.

Show comment
Hide comment
@saulojg

saulojg May 5, 2017

@joshuapinter @tacoman667 take a look at https://jitpack.io/, it'll let you use your forks in your projects with minimal hassle

saulojg commented May 5, 2017

@joshuapinter @tacoman667 take a look at https://jitpack.io/, it'll let you use your forks in your projects with minimal hassle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment