-
-
Save secondsun/17ce96082eda37dbd10e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post { | |
Long id; | |
String title; | |
Post(Long id, String title) { | |
this.id = id; | |
this.title = title; | |
} | |
} | |
class Comment { | |
Long id; | |
String body; | |
} | |
class Activity { | |
Pipeline pipeline = new Pipeline(BLOG_SERVER_URL); | |
Post parent = new Post(1, "Ex Post"); | |
void onCreate() { | |
PipeConfig commentsConfig = new PipeConfig(Comment.class); | |
commentsConfig.setParentPath("/post/${id}/"); | |
pipeline.pipe(Comment.class, commentsConfig); | |
} | |
void onStart() { | |
/** | |
* read(id, parent, callback) will look at the parent path, | |
* extract property keys (${id}) and then try to load those values | |
* from the parent object. (parentPost.id) | |
*/ | |
pipeline.get("comment", this).read(1, parentPost, new ActivityCallback()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment