1. /*
  2. * Copyright 2001-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.beanutils;
  17. /**
  18. * <p>A <strong>DynaClass</strong> is a simulation of the functionality of
  19. * <code>java.lang.Class</code> for classes implementing the
  20. * <code>DynaBean</code> interface. DynaBean instances that share the same
  21. * DynaClass all have the same set of available properties, along with any
  22. * associated data types, read-only states, and write-only states.</p>
  23. *
  24. * @author Craig McClanahan
  25. * @author Michael Smith
  26. * @author Paulo Gaspar
  27. * @version $Revision: 1.12 $ $Date: 2004/02/28 13:18:33 $
  28. */
  29. public interface DynaClass {
  30. /**
  31. * Return the name of this DynaClass (analogous to the
  32. * <code>getName()</code> method of <code>java.lang.Class</code), which
  33. * allows the same <code>DynaClass</code> implementation class to support
  34. * different dynamic classes, with different sets of properties.
  35. */
  36. public String getName();
  37. /**
  38. * Return a property descriptor for the specified property, if it exists;
  39. * otherwise, return <code>null</code>.
  40. *
  41. * @param name Name of the dynamic property for which a descriptor
  42. * is requested
  43. *
  44. * @exception IllegalArgumentException if no property name is specified
  45. */
  46. public DynaProperty getDynaProperty(String name);
  47. /**
  48. * <p>Return an array of <code>ProperyDescriptors</code> for the properties
  49. * currently defined in this DynaClass. If no properties are defined, a
  50. * zero-length array will be returned.</p>
  51. *
  52. * <p><strong>FIXME</strong> - Should we really be implementing
  53. * <code>getBeanInfo()</code> instead, which returns property descriptors
  54. * and a bunch of other stuff?</p>
  55. */
  56. public DynaProperty[] getDynaProperties();
  57. /**
  58. * Instantiate and return a new DynaBean instance, associated
  59. * with this DynaClass.
  60. *
  61. * @exception IllegalAccessException if the Class or the appropriate
  62. * constructor is not accessible
  63. * @exception InstantiationException if this Class represents an abstract
  64. * class, an array class, a primitive type, or void; or if instantiation
  65. * fails for some other reason
  66. */
  67. public DynaBean newInstance()
  68. throws IllegalAccessException, InstantiationException;
  69. }