1. /*
  2. * Copyright 1999-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.jxpath;
  17. import java.beans.PropertyDescriptor;
  18. /**
  19. * JXPathBeanInfo is similar to java.beans.BeanInfo in that it describes
  20. * properties of a JavaBean class. By default, JXPathBeanInfo classes are
  21. * automatically generated by {@link JXPathIntrospector JXPathIntrospector}
  22. * based on the java.beans.BeanInfo. As with JavaBeans, the user can supply an
  23. * alternative implementation of JXPathBeanInfo for a custom class. The
  24. * alternative implementation is located by class name, which is the same as the
  25. * name of the class it represents with the suffix "XBeanInfo". So, for
  26. * example, if you need to provide an alternative JXPathBeanInfo class for class
  27. * "com.foo.Bar", write a class "com.foo.BarXBeanInfo" and make it implement the
  28. * JXPathBeanInfo interface.
  29. *
  30. * @author Dmitri Plotnikov
  31. * @version $Revision: 1.7 $ $Date: 2004/02/29 14:17:42 $
  32. */
  33. public interface JXPathBeanInfo {
  34. /**
  35. * Returns true if objects of this class are treated as atomic
  36. * objects which have no properties of their own.
  37. * For example, java.lang.String and java.lang.Number are atomic.
  38. */
  39. boolean isAtomic();
  40. /**
  41. * Returns true if the objects of this class have dynamic properties
  42. * (e.g. java.util.Map). If this method returns true, getPropertyDescriptors
  43. * should return null and getDynamicPropertyHandlerClass should return
  44. * a valid class name. An object cannot have both static and dynamic
  45. * properties at the same time.
  46. */
  47. boolean isDynamic();
  48. /**
  49. * Returns a list of property descriptors for the beans described by this
  50. * bean info object. Returns null for atomic beans.
  51. */
  52. PropertyDescriptor[] getPropertyDescriptors();
  53. /**
  54. * Returns a PropertyDescriptor for the specified name or null if there
  55. * is no such property.
  56. */
  57. PropertyDescriptor getPropertyDescriptor(String propertyName);
  58. /**
  59. * For dynamic objects, returns the class implementing
  60. * the DynamicPropertyHandler interface. That class can
  61. * be used to access dynamic properties.
  62. */
  63. Class getDynamicPropertyHandlerClass();
  64. }