Spring BlazeDS Integration

org.springframework.flex.core.io
Class SpringPropertyProxy

java.lang.Object
  extended by flex.messaging.io.AbstractProxy
      extended by flex.messaging.io.BeanProxy
          extended by org.springframework.flex.core.io.SpringPropertyProxy
All Implemented Interfaces:
PropertyProxy, Serializable, Cloneable

public class SpringPropertyProxy
extends BeanProxy

Spring ConversionService-aware PropertyProxy that seeks to find an appropriate converter for a given bean property during AMF serialization and deserialization.

Uses Spring's PropertyAccessor interface for all property access, allowing for optional direct field access on the objects being serialized/deserialized.

Author:
Jeremy Grelle
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class flex.messaging.io.BeanProxy
BeanProxy.BeanProperty, BeanProxy.PropertyDescriptorCacheEntry
 
Field Summary
protected  Class<?> beanType
           
protected  ConversionService conversionService
           
protected  boolean useDirectFieldAccess
           
 
Fields inherited from class flex.messaging.io.BeanProxy
beanPropertyCache, cacheProperties, cachePropertiesDescriptors, ignoreProperties, propertyDescriptorCache, propertyNamesCache, stopClass
 
Fields inherited from class flex.messaging.io.AbstractProxy
alias, context, defaultInstance, descriptor, dynamic, externalizable, includeReadOnly, LOG_CATEGORY
 
Method Summary
 Class<?> getBeanType()
          The type for which this PropertyProxy is registered.
 Object getInstanceToSerialize(Object instance)
           Delegates to the configured ConversionService to potentially convert the instance to the registered bean type.
 List<String> getPropertyNames(Object instance)
          
 Class<?> getType(Object instance, String propertyName)
          
 Object getValue(Object instance, String propertyName)
           Delegates to the configured ConversionService to potentially convert the current value to the actual type of the property.
 boolean isWriteOnly(Object instance, String propertyName)
          
static SpringPropertyProxy proxyFor(Class<?> beanType, boolean useDirectFieldAccess, ConversionService conversionService)
          Factory method for creating correctly configured Spring property proxy instances.
 void setValue(Object instance, String propertyName, Object value)
           Delegates to the configured ConversionService to potentially convert the value to the actual type of the property.
 
Methods inherited from class flex.messaging.io.BeanProxy
addIgnoreProperty, clear, clone, getAlias, getBeanProperties, getBeanProperty, getBeanValue, getClassName, ignorePropertyErrors, isPropertyIgnored, isPublicAccessor, isPublicField, logPropertyErrors
 
Methods inherited from class flex.messaging.io.AbstractProxy
createInstance, createInstanceFromClassName, getAlias, getClassFromClassName, getDefaultInstance, getDescriptor, getIncludeReadOnly, getPropertyNames, getSerializationContext, getType, getValue, instanceComplete, isDynamic, isExternalizable, isExternalizable, setAlias, setCloneFieldsFrom, setDefaultInstance, setDescriptor, setDynamic, setExternalizable, setIncludeReadOnly, setSerializationContext, setValue, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

conversionService

protected final ConversionService conversionService

beanType

protected final Class<?> beanType

useDirectFieldAccess

protected final boolean useDirectFieldAccess
Method Detail

proxyFor

public static SpringPropertyProxy proxyFor(Class<?> beanType,
                                           boolean useDirectFieldAccess,
                                           ConversionService conversionService)
Factory method for creating correctly configured Spring property proxy instances.

Parameters:
beanType - the type being introspected
useDirectFieldAccess - whether to access fields directly
conversionService - the conversion service to use for property type conversion
Returns:
a properly configured property proxy

getBeanType

public Class<?> getBeanType()
The type for which this PropertyProxy is registered.

Returns:
the bean type

getInstanceToSerialize

public Object getInstanceToSerialize(Object instance)
Delegates to the configured ConversionService to potentially convert the instance to the registered bean type.

Specified by:
getInstanceToSerialize in interface PropertyProxy
Overrides:
getInstanceToSerialize in class AbstractProxy

getPropertyNames

public List<String> getPropertyNames(Object instance)

Specified by:
getPropertyNames in interface PropertyProxy
Overrides:
getPropertyNames in class BeanProxy

getType

public Class<?> getType(Object instance,
                        String propertyName)

Specified by:
getType in interface PropertyProxy
Overrides:
getType in class BeanProxy

getValue

public Object getValue(Object instance,
                       String propertyName)
Delegates to the configured ConversionService to potentially convert the current value to the actual type of the property.

Specified by:
getValue in interface PropertyProxy
Overrides:
getValue in class BeanProxy

isWriteOnly

public boolean isWriteOnly(Object instance,
                           String propertyName)

Overrides:
isWriteOnly in class BeanProxy

setValue

public void setValue(Object instance,
                     String propertyName,
                     Object value)
Delegates to the configured ConversionService to potentially convert the value to the actual type of the property.

Specified by:
setValue in interface PropertyProxy
Overrides:
setValue in class BeanProxy

Spring BlazeDS Integration

Copyright © 2011. All Rights Reserved.