Back to project page sres.
The source code is released under:
Apache License
If you think the Android project sres listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package me.tatarka.sres.property; //from w w w.j a v a 2 s. co m import me.tatarka.sres.AbstractTrackable; import me.tatarka.sres.ChangeTracker; /** * A Property is a value in which to can track changes. * * @param <T> the property type */ public class Property<T> extends AbstractTrackable { private T value; /** * Constructs a new property with the given initial value. * * @param value the initial value */ public Property(T value) { this.value = value; } /** * Sets the property's value, notifying all listeners that it has changed. * * @param value the new value */ public void set(T value) { this.value = value; notifyChange(); } /** * Gets the property's value. * * @return the current value */ public T get() { ChangeTracker.track(this); return value; } }