1 package com.fermod.observer;
3 import java.io.IOException;
4 import java.io.ObjectInputStream;
5 import java.io.ObjectOutputStream;
6 import java.io.Serializable;
49 public void set(T
value,
boolean notifyChange) {
51 T oldValue = this.
value;
54 if(notifyChange && oldValue !=
value) {
81 @SuppressWarnings(
"unchecked")
83 if ((this.value ==
null) ? (other.
value !=
null) : !this.value.equals(other.
value)) {
93 hash = 31 * hash + (this.value !=
null ? this.value.hashCode() : 0);
115 private void writeObject(ObjectOutputStream out)
throws IOException {
116 out.writeObject(
value);
144 @SuppressWarnings(
"unchecked")
145 private
void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
146 this.value = (T) in.readObject();
Class that wraps a value and gives the utility of registering listeners that will be called after any...
boolean equals(Object obj)
void notifyListeners(Consumer<? super T > action)
Notifies and executes on each of the registered listeners the provided function.
ObservedValue(T value)
Constructor of the class.
static final long serialVersionUID
Auto-generated serial version ID.
The listener interface for receiving value change events.
void writeObject(ObjectOutputStream out)
The writeObject method is responsible for writing the state of the object for its particular class so...
void readObject(ObjectInputStream in)
The readObject method is responsible for reading from the stream and restoring the classes fields.
Class that allows to register and notify event listeners.