// This example is from the book Developing Java Beans by Robert Englander.
// Copyright (c) 1997 O'Reilly & Associates.
// You may study, use, modify, and distribute this example for any purpose.
// This example is provided WITHOUT WARRANTY either expressed or implied.
// Chapter 10 -- The BoilerBeanInfo class
package BeansBook.Simulator;
import java.beans.*;
import java.lang.reflect.*;
public class BoilerBeanInfo extends SimpleBeanInfo
{
// return the bean descriptor
public BeanDescriptor getBeanDescriptor()
{
// create the bean descriptor object
BeanDescriptor bd = new BeanDescriptor(Boiler.class,
BoilerCustomizer.class);
// set the display name
bd.setDisplayName("Simulated Boiler");
// return the descriptor object
return bd;
}
// return the property descriptos
public PropertyDescriptor[] getPropertyDescriptors()
{
// for now this class defines none of its own properties,
// but this is implemented as a place holder
try
{
// create an empty array of descriptors
PropertyDescriptor[] pda = { };
// return the array
return pda;
}
catch (Exception e)
{
return null;
}
}
// return the additional bean info objects for the bean
public BeanInfo[] getAdditionalBeanInfo()
{
try
{
// create a bean info array that contains one object, which is
// the bean info for the base TemperatureModifier class. this
// bean info is retrieved via the Introspector
BeanInfo[] bia = { Introspector.getBeanInfo(TemperatureModifier.class) };
// return the bean info array
return bia;
}
catch (Exception e)
{
return null;
}
}
}
|