1.1 --- a/json/src/main/java/net/java/html/json/Models.java Fri Jul 04 09:24:57 2014 +0200
1.2 +++ b/json/src/main/java/net/java/html/json/Models.java Tue Jul 08 07:16:11 2014 +0200
1.3 @@ -141,4 +141,45 @@
1.4 public static void applyBindings(Object model) {
1.5 JSON.applyBindings(model);
1.6 }
1.7 +
1.8 + /** Stores the model value into local storage. Works in
1.9 + * orchestration with
1.10 + * {@link #getItem(net.java.html.BrwsrCtx, java.lang.String, java.lang.Class)}
1.11 + * method. The storage implementation may differ, but should
1.12 + * closely mimic the behaviour of <a href="http://www.w3.org/TR/webstorage/">webstorage</a>
1.13 + * specification.
1.14 + *
1.15 + * @param <Model> the class generated by {@link Model} annotation
1.16 + * or ({@link String}
1.17 + * @param key string representing the key to place the model value to
1.18 + * in the storage
1.19 + * @param model a non-<code>null</code> instance to place into the storage
1.20 + * @return <code>true</code> if the value was persistently stored,
1.21 + * <code>false</code> if the value is available only for current execution
1.22 + * of the application
1.23 + *
1.24 + * @since 0.8.3
1.25 + */
1.26 + public static <Model> boolean putItem(String key, Model model) {
1.27 + return false;
1.28 + }
1.29 +
1.30 + /** Obtains a value from a local storage. The value should have been
1.31 + * previously stored by {@link #putItem(java.lang.String, java.lang.Object)}
1.32 + * method. The storage implementation may differ, but should
1.33 + * closely mimic the behaviour of <a href="http://www.w3.org/TR/webstorage/">webstorage</a>
1.34 + * specification.
1.35 + *
1.36 + * @param <Model> type generated by {@link Model} annotation or {@link String}
1.37 + * @param ctx the browser context to use for the newly instantiated instance
1.38 + * @param key string representing the slot to read from the storage
1.39 + * @param clazz class generated by {@link Model} annotation or {@link String}
1.40 + * @return the instance of the model filled by the value found under
1.41 + * the key or <code>null</code> if no such key/value was found in
1.42 + * the storage
1.43 + * @since 0.8.3
1.44 + */
1.45 + public static <Model> Model getItem(BrwsrCtx ctx, String key, Class<Model> clazz) {
1.46 + return null;
1.47 + }
1.48 }
2.1 --- a/src/main/javadoc/overview.html Fri Jul 04 09:24:57 2014 +0200
2.2 +++ b/src/main/javadoc/overview.html Tue Jul 08 07:16:11 2014 +0200
2.3 @@ -75,6 +75,17 @@
2.4 yet the application code can be written in Java.
2.5 </p>
2.6
2.7 + <h3>What's New in Version 0.8.3?</h3>
2.8 +
2.9 + <p>
2.10 + An API to encapsulate access to
2.11 + <a href="http://www.w3.org/TR/webstorage/">webstorage</a>
2.12 + has been created. Use {@link net.java.html.json.Models#putItem}
2.13 + to store your data across sessions and
2.14 + {@link net.java.html.json.Models#getItem} to read them
2.15 + back.
2.16 + </p>
2.17 +
2.18 <h3>What's New in Version 0.8.2?</h3>
2.19
2.20 <p>