Пример #1
0
  /**
   * Set the value of the specified simple property of the specified bean, with no type conversions.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param bean Bean whose property is to be modified
   * @param name Name of the property to be modified
   * @param value Value to which the property should be set
   * @exception IllegalAccessException if the caller does not have access to the property accessor
   *     method
   * @exception IllegalArgumentException if <code>bean</code> or <code>name</code> is null
   * @exception IllegalArgumentException if the property name is nested or indexed
   * @exception InvocationTargetException if the property accessor method throws an exception
   * @exception NoSuchMethodException if an accessor method for this propety cannot be found
   * @see PropertyUtilsBean#setSimpleProperty
   */
  public static void setSimpleProperty(Object bean, String name, Object value)
      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    PropertyUtilsBean.getInstance().setSimpleProperty(bean, name, value);
  }
Пример #2
0
  /**
   * Return an accessible property setter method for this property, if there is one; otherwise
   * return <code>null</code>.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param descriptor Property descriptor to return a setter for
   * @return The write method
   * @see PropertyUtilsBean#getWriteMethod(PropertyDescriptor)
   */
  public static Method getWriteMethod(PropertyDescriptor descriptor) {

    return PropertyUtilsBean.getInstance().getWriteMethod(descriptor);
  }
Пример #3
0
  /**
   * Return <code>true</code> if the specified property name identifies a writeable property on the
   * specified bean; otherwise, return <code>false</code>.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param bean Bean to be examined (may be a {@link DynaBean}
   * @param name Property name to be evaluated
   * @return <code>true</code> if the property is writeable, otherwise <code>false</code>
   * @exception IllegalArgumentException if <code>bean</code> or <code>name</code> is <code>null
   *     </code>
   * @see PropertyUtilsBean#isWriteable
   * @since BeanUtils 1.6
   */
  public static boolean isWriteable(Object bean, String name) {

    return PropertyUtilsBean.getInstance().isWriteable(bean, name);
  }
Пример #4
0
  /**
   * Return an accessible property getter method for this property, if there is one; otherwise
   * return <code>null</code>.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param descriptor Property descriptor to return a getter for
   * @return The read method
   * @see PropertyUtilsBean#getReadMethod(PropertyDescriptor)
   */
  public static Method getReadMethod(PropertyDescriptor descriptor) {

    return (PropertyUtilsBean.getInstance().getReadMethod(descriptor));
  }
Пример #5
0
  /**
   * Return the value of the specified simple property of the specified bean, with no type
   * conversions.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param bean Bean whose property is to be extracted
   * @param name Name of the property to be extracted
   * @return The property value
   * @exception IllegalAccessException if the caller does not have access to the property accessor
   *     method
   * @exception IllegalArgumentException if <code>bean</code> or <code>name</code> is null
   * @exception IllegalArgumentException if the property name is nested or indexed
   * @exception InvocationTargetException if the property accessor method throws an exception
   * @exception NoSuchMethodException if an accessor method for this propety cannot be found
   * @see PropertyUtilsBean#getSimpleProperty
   */
  public static Object getSimpleProperty(Object bean, String name)
      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    return PropertyUtilsBean.getInstance().getSimpleProperty(bean, name);
  }
Пример #6
0
  /**
   * Retrieve the property descriptors for the specified bean, introspecting and caching them the
   * first time a particular bean class is encountered.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param bean Bean for which property descriptors are requested
   * @return the property descriptors
   * @exception IllegalArgumentException if <code>bean</code> is null
   * @see PropertyUtilsBean#getPropertyDescriptors(Object)
   */
  public static PropertyDescriptor[] getPropertyDescriptors(Object bean) {

    return PropertyUtilsBean.getInstance().getPropertyDescriptors(bean);
  }
Пример #7
0
  /**
   * Return the Java Class repesenting the property editor class that has been registered for this
   * property (if any).
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param bean Bean for which a property descriptor is requested
   * @param name Possibly indexed and/or nested name of the property for which a property descriptor
   *     is requested
   * @return the property editor class
   * @exception IllegalAccessException if the caller does not have access to the property accessor
   *     method
   * @exception IllegalArgumentException if <code>bean</code> or <code>name</code> is null
   * @exception IllegalArgumentException if a nested reference to a property returns null
   * @exception InvocationTargetException if the property accessor method throws an exception
   * @exception NoSuchMethodException if an accessor method for this propety cannot be found
   * @see PropertyUtilsBean#getPropertyEditorClass(Object,String)
   */
  public static Class getPropertyEditorClass(Object bean, String name)
      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    return PropertyUtilsBean.getInstance().getPropertyEditorClass(bean, name);
  }
Пример #8
0
  /**
   * Return the mapped property descriptors for this bean.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param bean Bean to be introspected
   * @return the mapped property descriptors
   * @see PropertyUtilsBean#getMappedPropertyDescriptors(Object)
   * @deprecated This method should not be exposed
   */
  public static FastHashMap getMappedPropertyDescriptors(Object bean) {

    return PropertyUtilsBean.getInstance().getMappedPropertyDescriptors(bean);
  }
Пример #9
0
  /**
   * Retrieve the property descriptors for the specified class, introspecting and caching them the
   * first time a particular bean class is encountered.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param beanClass Bean class for which property descriptors are requested
   * @return the property descriptors
   * @exception IllegalArgumentException if <code>beanClass</code> is null
   * @see PropertyUtilsBean#getPropertyDescriptors(Class)
   */
  public static PropertyDescriptor[] getPropertyDescriptors(Class beanClass) {

    return PropertyUtilsBean.getInstance().getPropertyDescriptors(beanClass);
  }
Пример #10
0
  /**
   * Return the mapped property descriptors for this bean class.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param beanClass Bean class to be introspected
   * @return the mapped property descriptors
   * @see PropertyUtilsBean#getMappedPropertyDescriptors(Class)
   * @deprecated This method should not be exposed
   */
  public static FastHashMap getMappedPropertyDescriptors(Class beanClass) {

    return PropertyUtilsBean.getInstance().getMappedPropertyDescriptors(beanClass);
  }
Пример #11
0
  /**
   * Return the value of the specified indexed property of the specified bean, with no type
   * conversions.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param bean Bean whose property is to be extracted
   * @param name Simple property name of the property value to be extracted
   * @param index Index of the property value to be extracted
   * @return the indexed property value
   * @exception IndexOutOfBoundsException if the specified index is outside the valid range for the
   *     underlying property
   * @exception IllegalAccessException if the caller does not have access to the property accessor
   *     method
   * @exception IllegalArgumentException if <code>bean</code> or <code>name</code> is null
   * @exception InvocationTargetException if the property accessor method throws an exception
   * @exception NoSuchMethodException if an accessor method for this propety cannot be found
   * @see PropertyUtilsBean#getIndexedProperty(Object,String, int)
   */
  public static Object getIndexedProperty(Object bean, String name, int index)
      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    return (PropertyUtilsBean.getInstance().getIndexedProperty(bean, name, index));
  }
Пример #12
0
  /**
   * Return the entire set of properties for which the specified bean provides a read method.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param bean Bean whose properties are to be extracted
   * @return The set of properties for the bean
   * @exception IllegalAccessException if the caller does not have access to the property accessor
   *     method
   * @exception IllegalArgumentException if <code>bean</code> is null
   * @exception InvocationTargetException if the property accessor method throws an exception
   * @exception NoSuchMethodException if an accessor method for this propety cannot be found
   * @see PropertyUtilsBean#describe
   */
  public static Map describe(Object bean)
      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    return (PropertyUtilsBean.getInstance().describe(bean));
  }
Пример #13
0
  /**
   * Copy property values from the "origin" bean to the "destination" bean for all cases where the
   * property names are the same (even though the actual getter and setter methods might have been
   * customized via <code>BeanInfo</code> classes).
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @param dest Destination bean whose properties are modified
   * @param orig Origin bean whose properties are retrieved
   * @exception IllegalAccessException if the caller does not have access to the property accessor
   *     method
   * @exception IllegalArgumentException if the <code>dest</code> or <code>orig</code> argument is
   *     null
   * @exception InvocationTargetException if the property accessor method throws an exception
   * @exception NoSuchMethodException if an accessor method for this propety cannot be found
   * @see PropertyUtilsBean#copyProperties
   */
  public static void copyProperties(Object dest, Object orig)
      throws IllegalAccessException, InvocationTargetException, NoSuchMethodException {

    PropertyUtilsBean.getInstance().copyProperties(dest, orig);
  }
Пример #14
0
  /**
   * Clear any cached property descriptors information for all classes loaded by any class loaders.
   * This is useful in cases where class loaders are thrown away to implement class reloading.
   *
   * <p>For more details see <code>PropertyUtilsBean</code>.
   *
   * @see PropertyUtilsBean#clearDescriptors
   */
  public static void clearDescriptors() {

    PropertyUtilsBean.getInstance().clearDescriptors();
  }