SlideShare una empresa de Scribd logo
1 de 26
Java Bean properties
Property
• Property is a public attribute of a bean that
  you can manipulate via getter and setter
  methods

• Properties typically correspond to fields that
  define the internal state of an object.



                    R.V.S.Lalitha.,M.Tech(Ph.D)    2
Properties
Active properties:
  Changing of a property can result in the firing of
  an event, these are called active properties.
  Active properties can be Bound or Constrained.
Bound and Constrained properties:
  Events used to notify, when a property is changed
  for a bean.
Standalone properties:
  It is standalone, which in this case means that it is
  not connected to via events to listeners.

                     R.V.S.Lalitha.,M.Tech(Ph.D)      3
Simple Properties
• getXXX() – accessor method to access internal
  variable
• isXXX() – accessor method to flag to the
  introspector a single valued boolean property




                   R.V.S.Lalitha.,M.Tech(Ph.D)    4
Simple Properties
public class person
{
private int age;
private boolean single;
person(int newage)
{
age=newage;
}
public int getAge()
{
return age;
}
public void setSingle(boolean status)
{
single=status;
}
public boolean isSingle()
{
return single;
                                        R.V.S.Lalitha.,M.Tech(Ph.D)   5
}}
Multi-valued indexed properties
          An indexed property contains a collection of values that are of same type.
Ex:
public class myfriends
{
private String friends[];
myfriends(String[] list)
{
friends=list;
}
public String getfriends(int index)
{
return friends[index];
}
public String[] getfriends()
{
return friends;
}


                                      R.V.S.Lalitha.,M.Tech(Ph.D)                      6
Bound Properties
                     classes and interfaces

                                                             Object class



PropertyChangeSupport


addPropertyChangeListener

                                                               PropertyChangeSupport
removePropertyChangeListener                                            class

firePropertyChange




                               R.V.S.Lalitha.,M.Tech(Ph.D)                             7
Bound Properties
      classes and interfaces
                                           EventListener
                                             interface




PropertyChange                       PropertyChangeListener
                                            interface




             R.V.S.Lalitha.,M.Tech(Ph.D)                      8
Bound Properties
              classes and interfaces
                                                    EventObject
                                                       class



PropertyChangeEvent


getPropertyName                                      PropertyChangeEvent
                                                             class

getNewValue




                      R.V.S.Lalitha.,M.Tech(Ph.D)                          9
R.V.S.Lalitha.,M.Tech(Ph.D)   10
Constrained Properties classes and interfaces
         Object class                      Exception class                      EventListener
                                                                                  interface
VetoableChangeSupport
addVetoableChangeListener                                    VetoableChange
removeVetoableChangeListener                                     Support
                                                                  class
fireVetoableChange


   PropertyVetoException

                                                         PropertyVetoExce
   getPropertyChangeEvent                                   ption class




  VetoableChange                                              VetoableChangeListener
                               R.V.S.Lalitha.,M.Tech(Ph.D)           interface           11
The Persistent bean streaming classes and interfaces




                   R.V.S.Lalitha.,M.Tech(Ph.D)         12
public class MyBean {
     String prop1;
  public String getProp1() {
     return prop1; }
  public void setProp1(String s) {
     prop1 = s; }
}
Bean Instantiation
try {
MyBean bean =
   (MyBean)Beans.instantiate(ClassLoader.getSystemClassLoader(),
   "MyBean");
} catch (ClassNotFoundException e) {
} catch (IOException e) {
}
Getting and setting properties of a
                     bean
Object o = new MyBean();
try {
  // Get the value of prop1
  Expression expr = new Expression(o, "getProp1", new Object[0]);
   expr.execute();
  String s = (String)expr.getValue();
   // Set the value of prop1
  Statement stmt = new Statement(o, "setProp1", new Object[]{"new
   string"});
stmt.execute();}
catch (Exception e) {}
//implementing a bound property

• // Create the listener list.
• PropertyChangeSupport pcs = new PropertyChangeSupport(this);
•  // The listener list wrapper methods.
• public synchronized void
  addPropertyChangeListener(PropertyChangeListener listener) {
  pcs.addPropertyChangeListener(listener);}
• public synchronized void
  removePropertyChangeListener(PropertyChangeListener listener) {
  pcs.removePropertyChangeListener(listener);}
//implementing a bound property

int myProperty;
public int getMyProperty() {
 return myProperty;}
public void setMyProperty(int newValue) {
   int oldValue = myProperty;
  myProperty = newValue;
    pcs.firePropertyChange("myProperty", new Integer(oldValue),
    new Integer(newValue));
}
//implementing constrained property
// Create the listener list.
VetoableChangeSupport vcs = new VetoableChangeSupport (this);
 // The listener list wrapper methods.
public synchronized void addVetoableChangeListener
    (VetoableChangeListener listener) {
    vcs.addVetoableChangeListener(listener);}
public synchronized void removeVetoableChangeListener
    (VetoableChangeListener listener) {
    vcs.removeVetoableChangeListener(listener);}
//implementing constrained property
int myProperty;
public int getMyProperty() {
   return myProperty;}
public void setMyProperty(int newValue) throws
   PropertyVetoException {
   try {
 vceListeners.fireVetoableChange( "myProperty", new
   Integer(myProperty), new Integer(newValue));
      myProperty = newValue;
   } catch (PropertyVetoException e) {
      throw e; }}
Reflection classes

      Object class



                                                                               Beans
       Classs class                                                        introspection
                                                                               classes



Method class                        Constructor
                 Array class                                 Field class       Modifier class
                                       class




                               R.V.S.Lalitha.,M.Tech(Ph.D)                                 20
The enhanced Class class
toString                                             getClasses
                        Class class
forName                                              getFields
newInstance                                          getMethods
isInstance                                           getConstructors
isAssignableForm                                     getField
isInterface                                          getMethod
isArray                                              getConstructor
isPrimitive                                          getDeclaredClass
getName                                              getDeclaredFields
getClassLoader                                       getDeclaredMethods
getSuperClass                                        getDeclaredConstructors
getInterface                                         getDeclaredField
getComponentType                                     getDeclaredMethod
getModifiers                                         getDeclaredConstructor
getSigners             R.V.S.Lalitha.,M.Tech(Ph.D)   getResourceAsStream       21
The Reflective Method Class
getDeclaringClass                                   getExceptionTypes
                    Method Class
getName                                             equals
getModifiers                                        hashCode
getReturnType                                       toString
getParameterTypes                                   invoke




                      R.V.S.Lalitha.,M.Tech(Ph.D)                       22
Java beans Introspection: An Overview
                                 Object class




           SimpleBeanInfo           FeatureDescriptor
                class                                               Introspector class
                                          class



  MethodDescriptor   EventSetDescr         PropertyDescri         ParameterDe
       class           iptor class           ptor class           scriptor class


   BeanDescripto                                          IndexedProper
      r class          BeanInfo class                      tyDescriptor
                                                               class
                            R.V.S.Lalitha.,M.Tech(Ph.D)                                  23
JavaBeans Introspection:The descriptor classes
FeatureDescriptor                                          isHidden
                         FeatureDescriptor
getName                                                    setHidden
                         Class
setName                                                    getShortDescription
getDisplayName                                             setShortDescription
setDisplayName                                             setValue
isExpert                                                   getValue
setExpert                                                  attributeName

BeanDescriptor
                     BeanDescripto            MethodDescriptor
                                                                      MethodDescr
getBeanClass                                  getMethod
                     r Class                                          iptor Class
getCustomizerClass                            getParameterDescrip
                                              tors




                             R.V.S.Lalitha.,M.Tech(Ph.D)                         24
EventSetDescriptor                                            getRemoveListenerMethod
                               EventSetDescriptor
getListenerType                                               setUnicast
                               class
getListernerMethods                                           isUnicast
getListernerMethodDescriptor                                  setinDefaultEventSet
s
getAddListenerMethod                                          isInDefaultEventSet


PropertyDescriptor                                            setBound
                               PropertyDescripto
getPropertyType                                               isConstrained
                               er Class
getReadMethod                                                 setConstrained
getWriteMethod                                                setPropertyEditorClass
isBound                                                       getPropertyEditorClass

ParameterDescriptor                          IndexedPropertyDesc IndexedPropertyDe
                       ParameterDes          riptor              scriptor Class
                       criptor Class
                                             getIndexedReadMeth
                                             od
                                                   getIndexedWriteMeth
                                  R.V.S.Lalitha.,M.Tech(Ph.D)                          25
                                             od
//listing the properties of a bean
try {
BeanInfo bi = Introspector.getBeanInfo(MyBean.class);
   PropertyDescriptor[] pds = bi.getPropertyDescriptors();
  for (int i=0; i<pds.length; i++) {
     // Get property name
    String propName = pds[i].getName(); }
   catch (java.beans.IntrospectionException e) {}

Más contenido relacionado

La actualidad más candente

javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1brecke
 
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Sagar Verma
 
11 Using classes and objects
11 Using classes and objects11 Using classes and objects
11 Using classes and objectsmaznabili
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with GroovyAli Tanwir
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slotsmha4
 
VJET bringing the best of Java and JavaScript together
VJET bringing the best of Java and JavaScript togetherVJET bringing the best of Java and JavaScript together
VJET bringing the best of Java and JavaScript togetherJustin Early
 
Statics in java | Constructors | Exceptions in Java | String in java| class 3
Statics in java | Constructors | Exceptions in Java | String in java| class 3Statics in java | Constructors | Exceptions in Java | String in java| class 3
Statics in java | Constructors | Exceptions in Java | String in java| class 3Sagar Verma
 
2008 Sccc Inheritance
2008 Sccc Inheritance2008 Sccc Inheritance
2008 Sccc Inheritancebergel
 
Defining classes-part-i-constructors-properties
Defining classes-part-i-constructors-propertiesDefining classes-part-i-constructors-properties
Defining classes-part-i-constructors-propertiesCtOlaf
 

La actualidad más candente (19)

10slide
10slide10slide
10slide
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
 
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
 
Unit i
Unit iUnit i
Unit i
 
oops-1
oops-1oops-1
oops-1
 
11 Using classes and objects
11 Using classes and objects11 Using classes and objects
11 Using classes and objects
 
Metaprogramming with Groovy
Metaprogramming with GroovyMetaprogramming with Groovy
Metaprogramming with Groovy
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots
 
core java
core javacore java
core java
 
VJET bringing the best of Java and JavaScript together
VJET bringing the best of Java and JavaScript togetherVJET bringing the best of Java and JavaScript together
VJET bringing the best of Java and JavaScript together
 
Statics in java | Constructors | Exceptions in Java | String in java| class 3
Statics in java | Constructors | Exceptions in Java | String in java| class 3Statics in java | Constructors | Exceptions in Java | String in java| class 3
Statics in java | Constructors | Exceptions in Java | String in java| class 3
 
2008 Sccc Inheritance
2008 Sccc Inheritance2008 Sccc Inheritance
2008 Sccc Inheritance
 
Defining classes-part-i-constructors-properties
Defining classes-part-i-constructors-propertiesDefining classes-part-i-constructors-properties
Defining classes-part-i-constructors-properties
 
Class and object in C++ By Pawan Thakur
Class and object in C++ By Pawan ThakurClass and object in C++ By Pawan Thakur
Class and object in C++ By Pawan Thakur
 
S313431 JPA 2.0 Overview
S313431 JPA 2.0 OverviewS313431 JPA 2.0 Overview
S313431 JPA 2.0 Overview
 
Stoop 400 o-metaclassonly
Stoop 400 o-metaclassonlyStoop 400 o-metaclassonly
Stoop 400 o-metaclassonly
 
java
java java
java
 
Java Programming - 05 access control in java
Java Programming - 05 access control in javaJava Programming - 05 access control in java
Java Programming - 05 access control in java
 
Inheritance Mixins & Traits
Inheritance Mixins & TraitsInheritance Mixins & Traits
Inheritance Mixins & Traits
 

Similar a Javabeanproperties

Inheritance And Traits
Inheritance And TraitsInheritance And Traits
Inheritance And TraitsPiyush Mishra
 
Using class and object java
Using class and object javaUsing class and object java
Using class and object javamha4
 
Cuối cùng cũng đã chuẩn bị slide xong cho seminar ngày mai. Mai seminar đầu t...
Cuối cùng cũng đã chuẩn bị slide xong cho seminar ngày mai. Mai seminar đầu t...Cuối cùng cũng đã chuẩn bị slide xong cho seminar ngày mai. Mai seminar đầu t...
Cuối cùng cũng đã chuẩn bị slide xong cho seminar ngày mai. Mai seminar đầu t...Khoa Nguyen
 
Framework prototype
Framework prototypeFramework prototype
Framework prototypeDevMix
 
Framework prototype
Framework prototypeFramework prototype
Framework prototypeDevMix
 
Framework prototype
Framework prototypeFramework prototype
Framework prototypeDevMix
 
Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)SURBHI SAROHA
 
Java interview questions
Java interview questionsJava interview questions
Java interview questionsamit kumar
 
Logic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with EclipseLogic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with EclipseCoen De Roover
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programmingNeelesh Shukla
 
Reflection in java
Reflection in javaReflection in java
Reflection in javaupen.rockin
 
L0043 - Interfacing to Eclipse Standard Views
L0043 - Interfacing to Eclipse Standard ViewsL0043 - Interfacing to Eclipse Standard Views
L0043 - Interfacing to Eclipse Standard ViewsTonny Madsen
 

Similar a Javabeanproperties (20)

Inheritance And Traits
Inheritance And TraitsInheritance And Traits
Inheritance And Traits
 
Using class and object java
Using class and object javaUsing class and object java
Using class and object java
 
chap11.ppt
chap11.pptchap11.ppt
chap11.ppt
 
Cuối cùng cũng đã chuẩn bị slide xong cho seminar ngày mai. Mai seminar đầu t...
Cuối cùng cũng đã chuẩn bị slide xong cho seminar ngày mai. Mai seminar đầu t...Cuối cùng cũng đã chuẩn bị slide xong cho seminar ngày mai. Mai seminar đầu t...
Cuối cùng cũng đã chuẩn bị slide xong cho seminar ngày mai. Mai seminar đầu t...
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)Java Beans Unit 4(Part 1)
Java Beans Unit 4(Part 1)
 
06 inheritance
06 inheritance06 inheritance
06 inheritance
 
Unit 3 Java
Unit 3 JavaUnit 3 Java
Unit 3 Java
 
1.6 oo traits
1.6 oo traits1.6 oo traits
1.6 oo traits
 
Java Beans
Java BeansJava Beans
Java Beans
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
Java Programming - 04 object oriented in java
Java Programming - 04 object oriented in javaJava Programming - 04 object oriented in java
Java Programming - 04 object oriented in java
 
Inheritance
InheritanceInheritance
Inheritance
 
Logic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with EclipseLogic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with Eclipse
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
 
Reflection in java
Reflection in javaReflection in java
Reflection in java
 
L0043 - Interfacing to Eclipse Standard Views
L0043 - Interfacing to Eclipse Standard ViewsL0043 - Interfacing to Eclipse Standard Views
L0043 - Interfacing to Eclipse Standard Views
 
Java Reflection Concept and Working
Java Reflection Concept and WorkingJava Reflection Concept and Working
Java Reflection Concept and Working
 

Más de vamsitricks (20)

Unit 6
Unit 6Unit 6
Unit 6
 
Np unit2
Np unit2Np unit2
Np unit2
 
Np unit1
Np unit1Np unit1
Np unit1
 
Np unit iv i
Np unit iv iNp unit iv i
Np unit iv i
 
Np unit iii
Np unit iiiNp unit iii
Np unit iii
 
Np unit iv ii
Np unit iv iiNp unit iv ii
Np unit iv ii
 
Unit 7
Unit 7Unit 7
Unit 7
 
Npc16
Npc16Npc16
Npc16
 
Npc14
Npc14Npc14
Npc14
 
Npc13
Npc13Npc13
Npc13
 
Npc08
Npc08Npc08
Npc08
 
Unit 3
Unit 3Unit 3
Unit 3
 
Unit 5
Unit 5Unit 5
Unit 5
 
Unit 2
Unit 2Unit 2
Unit 2
 
Unit 7
Unit 7Unit 7
Unit 7
 
Unit 6
Unit 6Unit 6
Unit 6
 
Unit 4
Unit 4Unit 4
Unit 4
 
Unit4wt
Unit4wtUnit4wt
Unit4wt
 
Unit3wt
Unit3wtUnit3wt
Unit3wt
 
Unit2wt
Unit2wtUnit2wt
Unit2wt
 

Javabeanproperties

  • 2. Property • Property is a public attribute of a bean that you can manipulate via getter and setter methods • Properties typically correspond to fields that define the internal state of an object. R.V.S.Lalitha.,M.Tech(Ph.D) 2
  • 3. Properties Active properties: Changing of a property can result in the firing of an event, these are called active properties. Active properties can be Bound or Constrained. Bound and Constrained properties: Events used to notify, when a property is changed for a bean. Standalone properties: It is standalone, which in this case means that it is not connected to via events to listeners. R.V.S.Lalitha.,M.Tech(Ph.D) 3
  • 4. Simple Properties • getXXX() – accessor method to access internal variable • isXXX() – accessor method to flag to the introspector a single valued boolean property R.V.S.Lalitha.,M.Tech(Ph.D) 4
  • 5. Simple Properties public class person { private int age; private boolean single; person(int newage) { age=newage; } public int getAge() { return age; } public void setSingle(boolean status) { single=status; } public boolean isSingle() { return single; R.V.S.Lalitha.,M.Tech(Ph.D) 5 }}
  • 6. Multi-valued indexed properties An indexed property contains a collection of values that are of same type. Ex: public class myfriends { private String friends[]; myfriends(String[] list) { friends=list; } public String getfriends(int index) { return friends[index]; } public String[] getfriends() { return friends; } R.V.S.Lalitha.,M.Tech(Ph.D) 6
  • 7. Bound Properties classes and interfaces Object class PropertyChangeSupport addPropertyChangeListener PropertyChangeSupport removePropertyChangeListener class firePropertyChange R.V.S.Lalitha.,M.Tech(Ph.D) 7
  • 8. Bound Properties classes and interfaces EventListener interface PropertyChange PropertyChangeListener interface R.V.S.Lalitha.,M.Tech(Ph.D) 8
  • 9. Bound Properties classes and interfaces EventObject class PropertyChangeEvent getPropertyName PropertyChangeEvent class getNewValue R.V.S.Lalitha.,M.Tech(Ph.D) 9
  • 11. Constrained Properties classes and interfaces Object class Exception class EventListener interface VetoableChangeSupport addVetoableChangeListener VetoableChange removeVetoableChangeListener Support class fireVetoableChange PropertyVetoException PropertyVetoExce getPropertyChangeEvent ption class VetoableChange VetoableChangeListener R.V.S.Lalitha.,M.Tech(Ph.D) interface 11
  • 12. The Persistent bean streaming classes and interfaces R.V.S.Lalitha.,M.Tech(Ph.D) 12
  • 13. public class MyBean { String prop1; public String getProp1() { return prop1; } public void setProp1(String s) { prop1 = s; } }
  • 14. Bean Instantiation try { MyBean bean = (MyBean)Beans.instantiate(ClassLoader.getSystemClassLoader(), "MyBean"); } catch (ClassNotFoundException e) { } catch (IOException e) { }
  • 15. Getting and setting properties of a bean Object o = new MyBean(); try { // Get the value of prop1 Expression expr = new Expression(o, "getProp1", new Object[0]); expr.execute(); String s = (String)expr.getValue(); // Set the value of prop1 Statement stmt = new Statement(o, "setProp1", new Object[]{"new string"}); stmt.execute();} catch (Exception e) {}
  • 16. //implementing a bound property • // Create the listener list. • PropertyChangeSupport pcs = new PropertyChangeSupport(this); • // The listener list wrapper methods. • public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { pcs.addPropertyChangeListener(listener);} • public synchronized void removePropertyChangeListener(PropertyChangeListener listener) { pcs.removePropertyChangeListener(listener);}
  • 17. //implementing a bound property int myProperty; public int getMyProperty() { return myProperty;} public void setMyProperty(int newValue) { int oldValue = myProperty; myProperty = newValue; pcs.firePropertyChange("myProperty", new Integer(oldValue), new Integer(newValue)); }
  • 18. //implementing constrained property // Create the listener list. VetoableChangeSupport vcs = new VetoableChangeSupport (this); // The listener list wrapper methods. public synchronized void addVetoableChangeListener (VetoableChangeListener listener) { vcs.addVetoableChangeListener(listener);} public synchronized void removeVetoableChangeListener (VetoableChangeListener listener) { vcs.removeVetoableChangeListener(listener);}
  • 19. //implementing constrained property int myProperty; public int getMyProperty() { return myProperty;} public void setMyProperty(int newValue) throws PropertyVetoException { try { vceListeners.fireVetoableChange( "myProperty", new Integer(myProperty), new Integer(newValue)); myProperty = newValue; } catch (PropertyVetoException e) { throw e; }}
  • 20. Reflection classes Object class Beans Classs class introspection classes Method class Constructor Array class Field class Modifier class class R.V.S.Lalitha.,M.Tech(Ph.D) 20
  • 21. The enhanced Class class toString getClasses Class class forName getFields newInstance getMethods isInstance getConstructors isAssignableForm getField isInterface getMethod isArray getConstructor isPrimitive getDeclaredClass getName getDeclaredFields getClassLoader getDeclaredMethods getSuperClass getDeclaredConstructors getInterface getDeclaredField getComponentType getDeclaredMethod getModifiers getDeclaredConstructor getSigners R.V.S.Lalitha.,M.Tech(Ph.D) getResourceAsStream 21
  • 22. The Reflective Method Class getDeclaringClass getExceptionTypes Method Class getName equals getModifiers hashCode getReturnType toString getParameterTypes invoke R.V.S.Lalitha.,M.Tech(Ph.D) 22
  • 23. Java beans Introspection: An Overview Object class SimpleBeanInfo FeatureDescriptor class Introspector class class MethodDescriptor EventSetDescr PropertyDescri ParameterDe class iptor class ptor class scriptor class BeanDescripto IndexedProper r class BeanInfo class tyDescriptor class R.V.S.Lalitha.,M.Tech(Ph.D) 23
  • 24. JavaBeans Introspection:The descriptor classes FeatureDescriptor isHidden FeatureDescriptor getName setHidden Class setName getShortDescription getDisplayName setShortDescription setDisplayName setValue isExpert getValue setExpert attributeName BeanDescriptor BeanDescripto MethodDescriptor MethodDescr getBeanClass getMethod r Class iptor Class getCustomizerClass getParameterDescrip tors R.V.S.Lalitha.,M.Tech(Ph.D) 24
  • 25. EventSetDescriptor getRemoveListenerMethod EventSetDescriptor getListenerType setUnicast class getListernerMethods isUnicast getListernerMethodDescriptor setinDefaultEventSet s getAddListenerMethod isInDefaultEventSet PropertyDescriptor setBound PropertyDescripto getPropertyType isConstrained er Class getReadMethod setConstrained getWriteMethod setPropertyEditorClass isBound getPropertyEditorClass ParameterDescriptor IndexedPropertyDesc IndexedPropertyDe ParameterDes riptor scriptor Class criptor Class getIndexedReadMeth od getIndexedWriteMeth R.V.S.Lalitha.,M.Tech(Ph.D) 25 od
  • 26. //listing the properties of a bean try { BeanInfo bi = Introspector.getBeanInfo(MyBean.class); PropertyDescriptor[] pds = bi.getPropertyDescriptors(); for (int i=0; i<pds.length; i++) { // Get property name String propName = pds[i].getName(); } catch (java.beans.IntrospectionException e) {}