-
Notifications
You must be signed in to change notification settings - Fork 1k
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
base: master
Are you sure you want to change the base?
Conversation
…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.
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 |
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 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. |
@joshuapinter Unfortunately, you will have to build the |
@tacoman667 Thanks for the response. Yeah, I figured it's not as easy as updating the GitHub branch on a 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. |
@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 |
@joshuapinter Glad I could help! Sad that this project seems dead though. :( TBH, I am more into RealmDB on mobile devices these days... |
@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. |
@joshuapinter @tacoman667 take a look at https://jitpack.io/, it'll let you use your forks in your projects with minimal hassle |
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.