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

  1. /*
  2.  * @(#)MethodDescriptor.java    1.16 96/12/06  
  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. import java.lang.reflect.*;
  26.  
  27. /**
  28.  * A MethodDescriptor describes a particular method that a Java Bean
  29.  * supports for external access from other components.
  30.  */
  31.  
  32. public class MethodDescriptor extends FeatureDescriptor {
  33.  
  34.     /**
  35.      * @param method    The low-level method information.
  36.      */
  37.     public MethodDescriptor(Method method) {
  38.     this.method = method;
  39.     setName(method.getName());
  40.     }
  41.  
  42.  
  43.     /**
  44.      * @param method    The low-level method information.
  45.      * @param parameterDescriptors  Descriptive information for each of the
  46.      *                 method's parameters.
  47.      */
  48.     public MethodDescriptor(Method method, 
  49.         ParameterDescriptor parameterDescriptors[]) {
  50.     this.method = method;
  51.     this.parameterDescriptors = parameterDescriptors;
  52.     setName(method.getName());
  53.     }
  54.  
  55.     /**
  56.      * @return The low-level description of the method
  57.      */
  58.     public Method getMethod() {
  59.     return method;
  60.     }
  61.  
  62.  
  63.     /**
  64.      * @return The locale-independent names of the parameters.  May return
  65.      *        a null array if the parameter names aren't known.
  66.      */
  67.     public ParameterDescriptor[] getParameterDescriptors() {
  68.     return parameterDescriptors;
  69.     }
  70.  
  71.     /*
  72.      * Package-private constructor
  73.      * Merge two method descriptors.  Where they conflict, give the
  74.      * second argument (y) priority over the first argument (x).
  75.      * @param x  The first (lower priority) MethodDescriptor
  76.      * @param y  The second (higher priority) MethodDescriptor
  77.      */
  78.  
  79.     MethodDescriptor(MethodDescriptor x, MethodDescriptor y) {
  80.     super(x,y);
  81.     method = x.method;
  82.     parameterDescriptors = x.parameterDescriptors;
  83.     if (y.parameterDescriptors != null) {
  84.         parameterDescriptors = y.parameterDescriptors;
  85.     }
  86.     }
  87.  
  88.     private Method method;
  89.     private ParameterDescriptor parameterDescriptors[];
  90. }
  91.