Updating to NBMs from NetBeans 8.0.1 as some of them are required to run on JDK8
1 package org.apidesign.javamonitorflaws;
3 import java.beans.PropertyChangeListener;
4 import java.beans.PropertyChangeSupport;
8 * @author Jaroslav Tulach <jtulach@netbeans.org>
10 // BEGIN: monitor.pitfalls.subclass
11 public class MultiplyCache extends Cache<String,Integer>
12 implements CacheTest.CacheToTest {
13 private PropertyChangeSupport pcs;
15 public static final String PROP_MULTIPLY = "multiply";
17 public synchronized int getMultiply() {
20 public synchronized void setMultiply(int multiply) {
21 int oldMultiply = this.multiply;
22 this.multiply = multiply;
23 pcs.firePropertyChange(PROP_MULTIPLY, oldMultiply, multiply);
26 public synchronized void addPropertyChangeListener(
27 PropertyChangeListener listener
30 pcs = new PropertyChangeSupport(this);
32 pcs.addPropertyChangeListener(listener);
34 public synchronized void removePropertyChangeListener(
35 PropertyChangeListener listener
38 pcs.removePropertyChangeListener(listener);
43 protected Integer createItem(String f) {
44 return f.length() * multiply;
47 // END: monitor.pitfalls.subclass