All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.beans.observables.properties.SimpleObservableProperty Maven / Gradle / Ivy

The newest version!
package com.beans.observables.properties;

import java.util.Objects;

/**
 * 

* A simple implementation of {@link ObservableProperty}, holding a * variable which is accessed for writing or reading through {@link #set(Object)} * and {@link #get()}. *

* * @param type of the property data. * * @since JavaBeans 1.0 */ public class SimpleObservableProperty extends ObservablePropertyBase { private T mValue; public SimpleObservableProperty(T initialValue) { super(false); mValue = initialValue; } /** * Initializes the property with a value of null. */ public SimpleObservableProperty() { this(null); } @Override public void set(T value) { if (!Objects.equals(mValue, value)) { T oldValue = mValue; mValue = value; fireValueChangedEvent(oldValue, value); } } @Override public T get() { return mValue; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy