接口 PropertyAccessor

    • 方法详细资料

      • isReadableProperty

        boolean isReadableProperty​(String propertyName)
        Determine whether the specified property is readable.

        Returns false if the property doesn't exist.

        参数:
        propertyName - the property to check (may be a nested path and/or an indexed/mapped property)
        返回:
        whether the property is readable
      • isWritableProperty

        boolean isWritableProperty​(String propertyName)
        Determine whether the specified property is writable.

        Returns false if the property doesn't exist.

        参数:
        propertyName - the property to check (may be a nested path and/or an indexed/mapped property)
        返回:
        whether the property is writable
      • getPropertyType

        Class<?> getPropertyType​(String propertyName)
                          throws BeansException
        Determine the property type for the specified property, either checking the property descriptor or checking the value in case of an indexed or mapped element.
        参数:
        propertyName - the property to check (may be a nested path and/or an indexed/mapped property)
        返回:
        the property type for the particular property, or null if not determinable
        抛出:
        PropertyAccessException - if the property was valid but the accessor method failed
        BeansException
      • getPropertyTypeDescriptor

        TypeDescriptor getPropertyTypeDescriptor​(String propertyName)
                                          throws BeansException
        Return a type descriptor for the specified property: preferably from the read method, falling back to the write method.
        参数:
        propertyName - the property to check (may be a nested path and/or an indexed/mapped property)
        返回:
        the property type for the particular property, or null if not determinable
        抛出:
        PropertyAccessException - if the property was valid but the accessor method failed
        BeansException
      • setPropertyValues

        void setPropertyValues​(Map<?,​?> map)
                        throws BeansException
        Perform a batch update from a Map.

        Bulk updates from PropertyValues are more powerful: This method is provided for convenience. Behavior will be identical to that of the setPropertyValues(PropertyValues) method.

        参数:
        map - Map to take properties from. Contains property value objects, keyed by property name
        抛出:
        InvalidPropertyException - if there is no such property or if the property isn't writable
        PropertyBatchUpdateException - if one or more PropertyAccessExceptions occurred for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated.
        BeansException
      • setPropertyValues

        void setPropertyValues​(PropertyValues pvs)
                        throws BeansException
        The preferred way to perform a batch update.

        Note that performing a batch update differs from performing a single update, in that an implementation of this class will continue to update properties if a recoverable error (such as a type mismatch, but not an invalid field name or the like) is encountered, throwing a PropertyBatchUpdateException containing all the individual errors. This exception can be examined later to see all binding errors. Properties that were successfully updated remain changed.

        Does not allow unknown fields or invalid fields.

        参数:
        pvs - PropertyValues to set on the target object
        抛出:
        InvalidPropertyException - if there is no such property or if the property isn't writable
        PropertyBatchUpdateException - if one or more PropertyAccessExceptions occurred for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated.
        BeansException
        另请参阅:
        setPropertyValues(PropertyValues, boolean, boolean)
      • setPropertyValues

        void setPropertyValues​(PropertyValues pvs,
                               boolean ignoreUnknown)
                        throws BeansException
        Perform a batch update with more control over behavior.

        Note that performing a batch update differs from performing a single update, in that an implementation of this class will continue to update properties if a recoverable error (such as a type mismatch, but not an invalid field name or the like) is encountered, throwing a PropertyBatchUpdateException containing all the individual errors. This exception can be examined later to see all binding errors. Properties that were successfully updated remain changed.

        参数:
        pvs - PropertyValues to set on the target object
        ignoreUnknown - should we ignore unknown properties (not found in the bean)
        抛出:
        InvalidPropertyException - if there is no such property or if the property isn't writable
        PropertyBatchUpdateException - if one or more PropertyAccessExceptions occurred for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated.
        BeansException
        另请参阅:
        setPropertyValues(PropertyValues, boolean, boolean)
      • setPropertyValues

        void setPropertyValues​(PropertyValues pvs,
                               boolean ignoreUnknown,
                               boolean ignoreInvalid)
                        throws BeansException
        Perform a batch update with full control over behavior.

        Note that performing a batch update differs from performing a single update, in that an implementation of this class will continue to update properties if a recoverable error (such as a type mismatch, but not an invalid field name or the like) is encountered, throwing a PropertyBatchUpdateException containing all the individual errors. This exception can be examined later to see all binding errors. Properties that were successfully updated remain changed.

        参数:
        pvs - PropertyValues to set on the target object
        ignoreUnknown - should we ignore unknown properties (not found in the bean)
        ignoreInvalid - should we ignore invalid properties (found but not accessible)
        抛出:
        InvalidPropertyException - if there is no such property or if the property isn't writable
        PropertyBatchUpdateException - if one or more PropertyAccessExceptions occurred for specific properties during the batch update. This exception bundles all individual PropertyAccessExceptions. All other properties will have been successfully updated.
        BeansException