1.1 --- a/json/src/main/java/net/java/html/json/Property.java Tue Aug 26 17:35:37 2014 +0200
1.2 +++ b/json/src/main/java/net/java/html/json/Property.java Mon Feb 22 06:09:33 2016 +0100
1.3 @@ -46,6 +46,8 @@
1.4 import java.lang.annotation.RetentionPolicy;
1.5 import java.lang.annotation.Target;
1.6 import java.util.List;
1.7 +import org.netbeans.html.context.spi.Contexts;
1.8 +import org.netbeans.html.json.spi.Technology;
1.9
1.10 /** Represents a property in a class defined with {@link Model} annotation.
1.11 *
1.12 @@ -76,4 +78,21 @@
1.13 * @return true, if this property is supposed to represent an array of values
1.14 */
1.15 boolean array() default false;
1.16 +
1.17 + /** Can the value of the property be mutated without restriction or not.
1.18 + * If a property is defined as <em>not mutable</em>, it defines
1.19 + * semi-immutable value that can only be changed in construction time
1.20 + * before the object is passed to underlying {@link Technology}.
1.21 + * Attempts to modify the object later yield {@link IllegalStateException}.
1.22 + *
1.23 + * Technologies may decide to represent such non-mutable
1.24 + * property in more effective way - for
1.25 + * example Knockout Java Bindings technology (with {@link Contexts.Id id} "ko4j")
1.26 + * uses plain JavaScript value (number, string, array, boolean) rather
1.27 + * than classical observable.
1.28 + *
1.29 + * @return false if the value cannot change after its <em>first use</em>
1.30 + * @since 1.3
1.31 + */
1.32 + boolean mutable() default true;
1.33 }