Results 1 to 5 of 5

Thread: Why we use Introspection in Java Beans?

  1. #1
    Join Date
    Aug 2006
    Posts
    155

    Why we use Introspection in Java Beans?

    Hello folks,
    I have recently started doing the Java Beans. So I don't have much knowledge about the Beans. I know that the introspection is one feature of the Java beans. But I don't know more about the introspection. I always get confused while this feature comes. Can anyone please explain me why we use Introspection in Java Beans.?? Any other information related to this topic would also be helpful.
    Desktop * Athlon X2 4200 | 2048M RAM | 160G HD | 7600GT
    MacMini * G4 1.33GHz | 512M RAM | 40G HD | Radeon 9200
    Laptop * Sempron 2800 | 512M RAM | 60G HD
    PDA * Dell Axim x51 | 128M Internal | 256M SD Card

  2. #2
    Join Date
    Mar 2008
    Posts
    349

    Re: Why we use Introspection in Java Beans?

    You can say that an Introspection is the automatic process of analyzing a bean's design patterns to reveal the bean's properties, events, and methods. By using this you can control the publishing and discovery of bean operations and properties. The JavaBeans API architecture supplies a set of classes and interfaces to provide introspection. Bean introspection is the process of discovering the properties, methods and events a Java Bean provides. The discovering is done by using the reflection API.

  3. #3
    Join Date
    Jul 2006
    Posts
    286

    Re: Why we use Introspection in Java Beans?

    The Introspector class provides a standard way for tools to learn about the properties, events, and methods supported by a target Java Bean. The BeanInfo interface of the java.beans package defines a set of methods that allow bean implementors to provide explicit information about their beans. Using this is very useful for the developer. Because by specifying BeanInfo for a bean component, a developer can hide methods, specify an icon for the toolbox, provide descriptive names for properties, define which properties are bound properties, etc. Due to which the user cannot see the coding that are used by the developer.
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

  4. #4
    Join Date
    Aug 2006
    Posts
    235

    Re: Why we use Introspection in Java Beans?

    Using an Introspection in Java Beans is very useful for the developers. The following are some useful purpose for using an Introspection in Java Beans :
    1. Reuse - If you are implementing the appropriate interfaces and extending the appropriate classes, the component with reuse potential are provided by you that possibly exceeds your expectations.
    2. Portability - Since you are doing every thing in Java platform, so you can write components once, reuse them everywhere.
    3.2 (northwood)
    2gig ram
    ATI AIW X800xt 256mb
    Gigabyte GA-8knxp 875p Chipset
    Optiwrite 8X DVD Burner
    Win XP PRO Sp2 (Works Perfectly)
    2 SATA Raptor 74gig Raid 0
    2 7200 IDE 320gig HD

  5. #5
    Join Date
    Jul 2006
    Posts
    442

    Re: Why we use Introspection in Java Beans?

    The following sample of coding in an example represents code to perform introspection :
    Code:
    import java.beans.BeanInfo;
    import java.beans.Introspector;
    import java.beans.IntrospectionException;
    import java.beans.PropertyDescriptor;
    
    public class BeanDemo
    {
        private final String name = "BeanDemo";
        private int size;
    
        public String getName()
        {
            return this.name;
        }
    
        public int getSize()
        {
            return this.size;
        }
    
        public void setSize( int size )
        {
            this.size = size;
        }
    
        public static void main( String[] args )
                throws IntrospectionException
        {
            BeanInfo info = Introspector.getBeanInfo( BeanDemo.class );
            for ( PropertyDescriptor pd : info.getPropertyDescriptors() )
                System.out.println( pd.getName() );
        }
    }
    "When they give you ruled paper, write the other way..." J.R.J.

Similar Threads

  1. What are an Enterprise Beans?
    By SKREECH in forum Software Development
    Replies: 5
    Last Post: 05-02-2010, 12:55 AM
  2. Java Beans Vs Servlets
    By Ram Bharose in forum Software Development
    Replies: 5
    Last Post: 02-02-2010, 11:53 AM
  3. What are the advantages of the java beans?
    By Bhavesh_seth in forum Software Development
    Replies: 3
    Last Post: 04-12-2009, 11:17 AM
  4. Concept of java beans
    By Jabeen in forum Software Development
    Replies: 4
    Last Post: 01-12-2009, 10:59 AM
  5. Replies: 3
    Last Post: 12-09-2009, 09:48 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,419,956.35212 seconds with 17 queries