home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (DummyBean.java)

This example Groovy source code file (DummyBean.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

awt, bean, dummybean, dummybean, hashmap, integer, integer, james, javabean, map, object, object, point, propertychangesupport, string, string, util

The Groovy DummyBean.java source code

 * Copyright 2003-2011 the original author or authors.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.codehaus.groovy.runtime;

import java.awt.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.HashMap;
import java.util.Map;

 * A bean used by the test cases
 * @author <a href="mailto:james@coredevelopers.net">James Strachan
 * @author <a href="mailto:shemnon@yahoo.com">Danno Ferrin
 * @version $Revision: 21515 $
public class DummyBean {
    private String name = "James";
    private Integer i = new Integer(123);
    private Map dynamicProperties = new HashMap();
    private Point point;
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);

    public DummyBean() {

    public DummyBean(String name) {
        this.name = name;

    public DummyBean(String name, Integer i) {
        this.name = name;
        this.i = i;

    public void addPropertyChangeListener(PropertyChangeListener listener) {

    public Integer getI() {
        return i;

    public void setI(Integer i) {
        changeSupport.firePropertyChange("i", this.i, this.i = i);

    public String getName() {
        return name;

    public void setName(String name) {
        changeSupport.firePropertyChange("name", this.name, this.name = name);

    // dynamic properties
    public Object get(String property) {
        return dynamicProperties.get(property);

    public void set(String property, Object newValue) {
        dynamicProperties.put(property, newValue);

    public static String dummyStaticMethod(String text) {
        return text.toUpperCase();

    public boolean equals(Object that) {
        if (that instanceof DummyBean) {
            return equals((DummyBean) that);
        return false;

    public boolean equals(DummyBean that) {
        return this.name.equals(that.name) && this.i.equals(that.i);

    public String toString() {
        return super.toString() + "[name=" + name + ";i=" + i + "]";

    public Point getPoint() {
        return point;

    public void setPoint(Point point) {
        changeSupport.firePropertyChange("point", this.point, this.point = point);


Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy DummyBean.java source code file:

new blog posts


Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.