home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / BeanDescriptor.java < prev    next >
Text File  |  1997-05-20  |  3KB  |  80 lines

  1. /*
  2.  * @(#)BeanDescriptor.java    1.10 96/12/18  
  3.  * 
  4.  * Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion bdk_beta
  20.  * 
  21.  */
  22.  
  23. package java.beans;
  24.  
  25. /**
  26.  * A BeanDescriptor provides global information about a "bean",
  27.  * including its Java class, its displayName, etc.
  28.  * <p>
  29.  * This is one of the kinds of descriptor returned by a BeanInfo object,
  30.  * which also returns descriptors for properties, method, and events.
  31.  */
  32.  
  33. public class BeanDescriptor extends FeatureDescriptor {
  34.  
  35.     /**
  36.      * Create a BeanDescriptor for a bean that doesn't have a customizer.
  37.      * @param beanClass  The Class object of the Java class that implements
  38.      *        the bean.  For example sun.beans.OurButton.class.
  39.      */
  40.     public BeanDescriptor(Class beanClass) {
  41.     this(beanClass, null);
  42.     }
  43.  
  44.     /**
  45.      * Create a BeanDescriptor for a bean that has a customizer.
  46.      * @param beanClass  The Class object of the Java class that implements
  47.      *        the bean.  For example sun.beans.OurButton.class.
  48.      * @param customizerClass  The Class object of the Java class that implements
  49.      *        the bean's Customizer.  For example sun.beans.OurButtonCustomizer.class.
  50.      */
  51.     public BeanDescriptor(Class beanClass, Class customizerClass) {
  52.     this.beanClass = beanClass;
  53.     this.customizerClass = customizerClass;
  54.     String name = beanClass.getName();
  55.     while (name.indexOf('.') >= 0) {
  56.         name = name.substring(name.indexOf('.')+1);
  57.     }
  58.     setName(name);
  59.     }
  60.  
  61.     /**
  62.      * @return The Class object for the bean.
  63.      */
  64.     public Class getBeanClass() {
  65.     return beanClass;
  66.     }
  67.  
  68.     /**
  69.      * @return The Class object for the bean's customizer.  This may
  70.      * be null if the bean doesn't have a customizer.
  71.      */
  72.     public Class getCustomizerClass() {
  73.     return customizerClass;
  74.     }
  75.  
  76.     private Class beanClass;
  77.     private Class customizerClass;
  78.  
  79. }
  80.