package introspectiondemo;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
class EmployeeBean implements Serializable { //1. Implementing serializable
//2. Private members
private int id;
private String name;
//3. public no-args constructors
public EmployeeBean(){};
//4. Create getter and setter methods
public void setId(int id)
{
[Link] = id;
}
public int getId()
{
return id;
}
public void setName(String name)
{
[Link] = name;
}
public String getName()
{
return name;
}
public void Hello()
{
[Link]("Hello Java Bean...");
}
public void Bye()
{
[Link]("Bye bye Java Bean...");
}
}
public class IntrospectionExample {
public static void main(String[] args) {
//EmployeeBean emp = new EmployeeBean();
try {
// Get the BeanInfo for a class
BeanInfo beanInfo = [Link]([Link]);
// Get the property descriptors
PropertyDescriptor[] propertyDescriptors =
[Link]();
[Link]("Properties:");
for (PropertyDescriptor descriptor : propertyDescriptors) {
[Link]([Link]());
}
// Get the method descriptors
Method[] methods = [Link]();
[Link]("\nMethods:");
for (Method method : methods) {
[Link]([Link]());
}
}
catch(IntrospectionException e)
{
[Link]();
}
}
}