flex.messaging.io
Class AbstractProxy

java.lang.Object
  extended by flex.messaging.io.AbstractProxy
All Implemented Interfaces:
PropertyProxy, Serializable
Direct Known Subclasses:
BeanProxy, PageableRowSetProxy, StatusInfoProxy

public abstract class AbstractProxy
extends Object
implements PropertyProxy, Serializable

Simple abstract implementation of PropertyProxy's common properties. Specific sub-classes need to provide the full implementation focusing on the retrieval of the instance traits or "list of properties" and a specific value for a given property name.

See Also:
PropertyProxy, Serialized Form

Method Summary
 Object clone()
          Returns a copy of the PropertyProxy so that it can be used as a template without modifying/creating global references to instances, descriptors etc.
 Object createInstance(String className)
          Creates a new instance for the given className.
static Object createInstanceFromClassName(String className)
          A utility method which creates an instance from a given class name.
 String getAlias()
          The class name alias for the default instance.
static Class getClassFromClassName(String className)
          A utility method which returns the Class from the given Class name using the current type context's class loader.
 Object getDefaultInstance()
          The default instance managed by this PropertyProxy.
 SerializationDescriptor getDescriptor()
          A serialization descriptor that provides overrides to the default behavior for selecting properties for serialization.
 boolean getIncludeReadOnly()
          Determines whether read only properties from the instance should be included during default serialization.
 Object getInstanceToSerialize(Object instance)
          Returns the instance to serialize in place of the supplied instance.
 List getPropertyNames()
          The List of property names as Strings that make up the traits of the default instance.
 SerializationContext getSerializationContext()
          The context holds settings that govern serialization behavior.
 Class getType(String propertyName)
          Looks up the Class type of the property by name on the default instance.
 Object getValue(String propertyName)
          Looks up the value of the property by name from the default instance.
 Object instanceComplete(Object instance)
          This is called after the serialization finishes.
 boolean isDynamic()
          The trait setting "dynamic" is a client-only concept for types that allow for arbitrary public properties to be defined at runtime.
 boolean isExternalizable()
          Specifies whether the default instance manages its own serialization through the Externalizable interface.
 boolean isExternalizable(Object instance)
          Specifies whether the given instance manages its own serialization through the Externalizable interface.
 void setAlias(String value)
          Allows an alias to be set for the instance type.
 void setDefaultInstance(Object instance)
          Sets the default instance managed by this PropertyProxy.
 void setDescriptor(SerializationDescriptor descriptor)
          Allows non-default inclusion/exclusion of properties for serialization.
 void setDynamic(boolean value)
          Dynamic is a client-only concept for types that allow for arbitrary public properties to be defined at runtime.
 void setExternalizable(boolean value)
          Specifies whether the given instance manages its own serialization through the Externalizable interface.
 void setIncludeReadOnly(boolean value)
          If set to true, read only properties will be included during default serialization.
 void setSerializationContext(SerializationContext value)
          Sets the context for serialization behavior.
 void setValue(String propertyName, Object value)
          Updates the value of a propery by name for the default instance.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface flex.messaging.io.PropertyProxy
getAlias, getPropertyNames, getType, getValue, setValue
 

Method Detail

getDefaultInstance

public Object getDefaultInstance()
Description copied from interface: PropertyProxy
The default instance managed by this PropertyProxy. The default instance is used for one-type proxied instances.

Specified by:
getDefaultInstance in interface PropertyProxy
Returns:
The proxied instance.

setDefaultInstance

public void setDefaultInstance(Object instance)
Description copied from interface: PropertyProxy
Sets the default instance managed by this PropertyProxy.

Specified by:
setDefaultInstance in interface PropertyProxy
Parameters:
instance - The default instance.

getClassFromClassName

public static Class getClassFromClassName(String className)
A utility method which returns the Class from the given Class name using the current type context's class loader.


createInstanceFromClassName

public static Object createInstanceFromClassName(String className)
A utility method which creates an instance from a given class name. It assumes the class has a zero arg constructor.


createInstance

public Object createInstance(String className)
Description copied from interface: PropertyProxy
Creates a new instance for the given className. ClassName is the value of the "alias" for the ActionScript class serialized. If the className is invalid an anonymous ASObject is created. If the className is prefixed with ">" an ASObject is created with the type set however a concrete instance is not instantiated.

Specified by:
createInstance in interface PropertyProxy

getPropertyNames

public List getPropertyNames()
Description copied from interface: PropertyProxy
The List of property names as Strings that make up the traits of the default instance. These traits determine which properties are to be serialized.

Specified by:
getPropertyNames in interface PropertyProxy
Returns:
The set of property names as Strings to be serialized.

getType

public Class getType(String propertyName)
Description copied from interface: PropertyProxy
Looks up the Class type of the property by name on the default instance.

Specified by:
getType in interface PropertyProxy
Parameters:
propertyName - The name of the property.
Returns:
The property type.

getValue

public Object getValue(String propertyName)
Description copied from interface: PropertyProxy
Looks up the value of the property by name from the default instance.

Specified by:
getValue in interface PropertyProxy
Parameters:
propertyName - The name of the property.
Returns:
The value of the given property.

setValue

public void setValue(String propertyName,
                     Object value)
Description copied from interface: PropertyProxy
Updates the value of a propery by name for the default instance.

Specified by:
setValue in interface PropertyProxy

setAlias

public void setAlias(String value)
Description copied from interface: PropertyProxy
Allows an alias to be set for the instance type. By default the classname of the instance is used.

Specified by:
setAlias in interface PropertyProxy
Parameters:
value - The class name alias.

getAlias

public String getAlias()
Description copied from interface: PropertyProxy
The class name alias for the default instance.

Specified by:
getAlias in interface PropertyProxy
Returns:
The class name alias to be used in serializing the type traits.

setDynamic

public void setDynamic(boolean value)
Description copied from interface: PropertyProxy
Dynamic is a client-only concept for types that allow for arbitrary public properties to be defined at runtime. This setting isn't yet relevant for serialization but can still be set in the Object traits.

Specified by:
setDynamic in interface PropertyProxy
Parameters:
value - Whether the client type is expected to be dynamic. This setting is currently not used.

isDynamic

public boolean isDynamic()
Description copied from interface: PropertyProxy
The trait setting "dynamic" is a client-only concept for types that allow for arbitrary public properties to be defined at runtime. The default is false and it is unlikely that it would need to be set.

Specified by:
isDynamic in interface PropertyProxy
Returns:
The dynamic client trait setting to be used during serialization of the type.

isExternalizable

public boolean isExternalizable()
Description copied from interface: PropertyProxy
Specifies whether the default instance manages its own serialization through the Externalizable interface.

Specified by:
isExternalizable in interface PropertyProxy
Returns:
Whether the default instance implements java.io.Externalizable.

setExternalizable

public void setExternalizable(boolean value)
Description copied from interface: PropertyProxy
Specifies whether the given instance manages its own serialization through the Externalizable interface. If this property is set to true then the type must implement java.io.Externalizable. Setting this property to false allows an otherwise Externalizable instance to be considered as a normal type for custom serialization.

Specified by:
setExternalizable in interface PropertyProxy
Parameters:
value - if set to true the instance must implement java.io.Externalizable, otherwise if set to false the proxied type can avoid external serialization for an otherwise Externalizable type.

isExternalizable

public boolean isExternalizable(Object instance)
Description copied from interface: PropertyProxy
Specifies whether the given instance manages its own serialization through the Externalizable interface.

Specified by:
isExternalizable in interface PropertyProxy
Returns:
Whether the given instance implements java.io.Externalizable.

getSerializationContext

public SerializationContext getSerializationContext()
Description copied from interface: PropertyProxy
The context holds settings that govern serialization behavior.

Specified by:
getSerializationContext in interface PropertyProxy
Returns:
The current serialization context, or a new default instance if undefined.

setSerializationContext

public void setSerializationContext(SerializationContext value)
Description copied from interface: PropertyProxy
Sets the context for serialization behavior.

Specified by:
setSerializationContext in interface PropertyProxy

setIncludeReadOnly

public void setIncludeReadOnly(boolean value)
Description copied from interface: PropertyProxy
If set to true, read only properties will be included during default serialization. The default is false.

Specified by:
setIncludeReadOnly in interface PropertyProxy
Parameters:
value - whether read only properties should be included.

getIncludeReadOnly

public boolean getIncludeReadOnly()
Description copied from interface: PropertyProxy
Determines whether read only properties from the instance should be included during default serialization. The default is false.

Specified by:
getIncludeReadOnly in interface PropertyProxy
Returns:
Whether read only properties should be included during default serialization.

getDescriptor

public SerializationDescriptor getDescriptor()
Description copied from interface: PropertyProxy
A serialization descriptor that provides overrides to the default behavior for selecting properties for serialization. At any given level a list of includes and excludes can be specified. Complex child properties can have their own descriptors specified in a nested manner.

Specified by:
getDescriptor in interface PropertyProxy
Returns:
The serialization descriptor for custom serialization.

setDescriptor

public void setDescriptor(SerializationDescriptor descriptor)
Description copied from interface: PropertyProxy
Allows non-default inclusion/exclusion of properties for serialization.

Specified by:
setDescriptor in interface PropertyProxy
Parameters:
descriptor - The descriptor to customize property selection for serialization.

instanceComplete

public Object instanceComplete(Object instance)
This is called after the serialization finishes. We return the same object here... this is an opportunity to replace the instance we use once we have gathered all of the state into a temporary object.

Specified by:
instanceComplete in interface PropertyProxy
Parameters:
instance - the instance being deserialized (previously returned from a createInstance call)
Returns:
possibly the same instance to use for this object.

getInstanceToSerialize

public Object getInstanceToSerialize(Object instance)
Returns the instance to serialize in place of the supplied instance.

Specified by:
getInstanceToSerialize in interface PropertyProxy
Parameters:
instance - the instance encountered during AMF serialization
Returns:
the instance you want to serialize in its place

clone

public Object clone()
Description copied from interface: PropertyProxy
Returns a copy of the PropertyProxy so that it can be used as a template without modifying/creating global references to instances, descriptors etc.

Specified by:
clone in interface PropertyProxy
Overrides:
clone in class Object
Returns:
A copy of the PropertyProxy.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/io/AbstractProxy.html