1 46 47 package org.codehaus.groovy.runtime; 48 49 import java.awt.Point ; 50 import java.beans.PropertyChangeListener ; 51 import java.beans.PropertyChangeSupport ; 52 import java.util.HashMap ; 53 import java.util.Map ; 54 55 61 public class DummyBean { 62 private String name = "James"; 63 private Integer i = new Integer (123); 64 private Map dynamicProperties = new HashMap (); 65 private Point point; 66 private PropertyChangeSupport changeSupport = new PropertyChangeSupport (this); 67 68 public DummyBean() { 69 } 70 71 public DummyBean(String name) { 72 this.name = name; 73 } 74 75 public DummyBean(String name, Integer i) { 76 this.name = name; 77 this.i = i; 78 } 79 80 public void addPropertyChangeListener(PropertyChangeListener listener) { 81 changeSupport.addPropertyChangeListener(listener); 82 } 83 84 public Integer getI() { 85 return i; 86 } 87 88 public void setI(Integer i) { 89 this.i = i; 90 } 91 92 public String getName() { 93 return name; 94 } 95 96 public void setName(String name) { 97 this.name = name; 98 } 99 100 public Object get(String property) { 102 return dynamicProperties.get(property); 103 } 104 105 public void set(String property, Object newValue) { 106 dynamicProperties.put(property, newValue); 107 } 108 109 public static String dummyStaticMethod(String text) { 110 return text.toUpperCase(); 111 } 112 113 public boolean equals(Object that) { 114 if (that instanceof DummyBean) { 115 return equals((DummyBean) that); 116 } 117 return false; 118 } 119 120 public boolean equals(DummyBean that) { 121 return this.name.equals(that.name) && this.i.equals(that.i); 122 } 123 124 public String toString() { 125 return super.toString() + "[name=" + name + ";i=" + i + "]"; 126 } 127 128 public Point getPoint() { 129 return point; 130 } 131 132 public void setPoint(Point point) { 133 this.point = point; 134 } 135 136 } 137 | Popular Tags |