Comments (4)
I agreed. Then when I started to remove the class, I realized we just need to document the purpose in using JSON as an asynchronously-updatable data model better. Update is below.
- The point of JSONModel is, like XMLModel, to allow you to create a local Object of type
- JSONModel which may last the entire life of your application. You can then
- refer to values from JSONModel and know that it always contains the latest,
- best JSONObject received from the server or loaded from the local cache.
- You can update the value in JSONModel by passing it as an object when you
- call JSONGetter(url, myJSONMOdel). If you would like to execute some code such
- as updating the user interface after the JSONModel is updated asynchonously,
- you should chain() that continuation code (a Task or UITask) to the JSONGetter.
from tantalum.
Ok, got it! So Task chain():ed after JSONGetter now get JSONObject is input parameter, right?
from tantalum.
Yes. JSONModel is a parameter, it holds your current version of the JSONObject. This will automatgically be asynchronously be replaced by the JSONGetter. If you want to be "notified" when this happens, chain().
I don't really like static notifier pattern common in Java. Too rigid. In most cases, the code is much cleaner and most logical flow visible on one screen when you provide your own lambda expression each time you initiate an async operation.
from tantalum.
Yep, but if I chain() a Task after JsonGetter, do I get JSONObject that was received as argument to doInBackground()?
You typically need the whole JSONObject, not the intermediate JSONModel.
from tantalum.
Related Issues (20)
- Fix Linux build HOT 4
- JavaDoc has useless stubs showing HOT 1
- Study: Explicit LWUIT support HOT 1
- PlatformAdapter for JSE HOT 3
- Tantalum Gradle build fails with latest version 1.5 of Gradle HOT 2
- Gradle findbugs output is in XML, could be in HTML HOT 2
- Remove "android stubs" from the main project HOT 5
- AndroidPlatformAdapter missing default ctor, doesn't work
- Agree on "full name" of project HOT 4
- init() call missing from setProgram for Android HOT 1
- Geocoder examples need to be updated
- JsonGetter::exec() should return "null" on error HOT 6
- JsonGetter doesn't survive if Content-Length is missing HOT 5
- Constructor with default priority should be provided HOT 4
- Put initialization in platform specific classses. HOT 8
- Continuous integration for Tantalum HOT 1
- CI for Tantalum HOT 7
- Preprocessing disabled HOT 1
- Promises (research) HOT 1
- Generics (research)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tantalum.