info.joseluismartin.gui.bind
Class DirectFieldAccessor

java.lang.Object
  extended by org.springframework.beans.PropertyEditorRegistrySupport
      extended by org.springframework.beans.AbstractPropertyAccessor
          extended by info.joseluismartin.gui.bind.DirectFieldAccessor
All Implemented Interfaces:
org.springframework.beans.ConfigurablePropertyAccessor, org.springframework.beans.PropertyAccessor, org.springframework.beans.PropertyEditorRegistry, org.springframework.beans.TypeConverter

public class DirectFieldAccessor
extends org.springframework.beans.AbstractPropertyAccessor

PropertyAccessor implementation that directly accesses instance fields. Allows for direct binding to fields instead of going through JavaBean setters.

This implementation just supports fields in the actual target object. It is not able to traverse nested fields.

A DirectFieldAccessor's default for the "extractOldValueForEditor" setting is "true", since a field can always be read without side effects. Note: This class was copied from spring framework for use in AbstractView until SPR-8389 become fixed and released. Don't use it, it will be deleted soon

Since:
2.0
Author:
Juergen Hoeller
See Also:
AbstractPropertyAccessor.setExtractOldValueForEditor(boolean), BeanWrapper, DirectFieldBindingResult, DataBinder.initDirectFieldAccess()

Field Summary
 
Fields inherited from interface org.springframework.beans.PropertyAccessor
NESTED_PROPERTY_SEPARATOR, NESTED_PROPERTY_SEPARATOR_CHAR, PROPERTY_KEY_PREFIX, PROPERTY_KEY_PREFIX_CHAR, PROPERTY_KEY_SUFFIX, PROPERTY_KEY_SUFFIX_CHAR
 
Constructor Summary
DirectFieldAccessor(Object target)
          Create a new DirectFieldAccessor for the given target object.
 
Method Summary
<T> T
convertIfNecessary(Object value, Class<T> requiredType, org.springframework.core.MethodParameter methodParam)
           
 Class<?> getPropertyType(String propertyName)
           
 org.springframework.core.convert.TypeDescriptor getPropertyTypeDescriptor(String propertyName)
           
 Object getPropertyValue(String propertyName)
           
 boolean isReadableProperty(String propertyName)
           
 boolean isWritableProperty(String propertyName)
           
 void setPropertyValue(String propertyName, Object newValue)
           
 
Methods inherited from class org.springframework.beans.AbstractPropertyAccessor
convertIfNecessary, isExtractOldValueForEditor, setExtractOldValueForEditor, setPropertyValue, setPropertyValues, setPropertyValues, setPropertyValues, setPropertyValues
 
Methods inherited from class org.springframework.beans.PropertyEditorRegistrySupport
copyCustomEditorsTo, copyDefaultEditorsTo, findCustomEditor, getConversionService, getDefaultEditor, guessPropertyTypeFromEditors, hasCustomEditorForElement, isSharedEditor, overrideDefaultEditor, registerCustomEditor, registerCustomEditor, registerDefaultEditors, registerSharedEditor, setConversionService, useConfigValueEditors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.beans.ConfigurablePropertyAccessor
getConversionService, setConversionService
 
Methods inherited from interface org.springframework.beans.PropertyEditorRegistry
findCustomEditor, registerCustomEditor, registerCustomEditor
 

Constructor Detail

DirectFieldAccessor

public DirectFieldAccessor(Object target)
Create a new DirectFieldAccessor for the given target object.

Parameters:
target - the target object to access
Method Detail

isReadableProperty

public boolean isReadableProperty(String propertyName)
                           throws org.springframework.beans.BeansException
Throws:
org.springframework.beans.BeansException

isWritableProperty

public boolean isWritableProperty(String propertyName)
                           throws org.springframework.beans.BeansException
Throws:
org.springframework.beans.BeansException

getPropertyType

public Class<?> getPropertyType(String propertyName)
                         throws org.springframework.beans.BeansException
Specified by:
getPropertyType in interface org.springframework.beans.PropertyAccessor
Overrides:
getPropertyType in class org.springframework.beans.AbstractPropertyAccessor
Throws:
org.springframework.beans.BeansException

getPropertyTypeDescriptor

public org.springframework.core.convert.TypeDescriptor getPropertyTypeDescriptor(String propertyName)
                                                                          throws org.springframework.beans.BeansException
Throws:
org.springframework.beans.BeansException

getPropertyValue

public Object getPropertyValue(String propertyName)
                        throws org.springframework.beans.BeansException
Specified by:
getPropertyValue in interface org.springframework.beans.PropertyAccessor
Specified by:
getPropertyValue in class org.springframework.beans.AbstractPropertyAccessor
Throws:
org.springframework.beans.BeansException

setPropertyValue

public void setPropertyValue(String propertyName,
                             Object newValue)
                      throws org.springframework.beans.BeansException
Specified by:
setPropertyValue in interface org.springframework.beans.PropertyAccessor
Specified by:
setPropertyValue in class org.springframework.beans.AbstractPropertyAccessor
Throws:
org.springframework.beans.BeansException

convertIfNecessary

public <T> T convertIfNecessary(Object value,
                                Class<T> requiredType,
                                org.springframework.core.MethodParameter methodParam)
                     throws org.springframework.beans.TypeMismatchException
Throws:
org.springframework.beans.TypeMismatchException


Copyright © 2013 JDAL. All Rights Reserved.