flex.messaging.io
Class PropertyProxyRegistry

java.lang.Object
  extended by flex.messaging.io.PropertyProxyRegistry

public class PropertyProxyRegistry
extends Object

Allows custom PropertyProxy's to be registered on a Class basis. Class hierarchies can be optionally searched with the first match winning. The search starts by trying an exact Class match, then the immediate interfaces are tried in the order that they are declared on the Class and finally the process is repeated for the superclass, if one exists. If a PropertyProxy is found in the immediate parent hierarchy (either the immediate superclass or directly implemented interfaces) then the implementing class is registered with the selected PropertyProxy to optimize subsequent searches.


Constructor Summary
PropertyProxyRegistry()
          Constructs an empty PropertyProxy registry.
 
Method Summary
 void clear()
          Removes all items from the class registry.
 PropertyProxy getProxy(Class c)
          Locates a custom PropertyProxy for the given Class.
 PropertyProxy getProxy(Class c, boolean searchHierarchy, boolean autoRegister)
          Locates a custom PropertyProxy for the given Class.
static PropertyProxy getProxy(Object instance)
          Returns a PropertyProxy suitable for the given instance but does not register the selected PropertyProxy for the Class of the instance.
 PropertyProxy getProxyAndRegister(Class c)
          Locates a custom PropertyProxy for the given Class.
static PropertyProxy getProxyAndRegister(Object instance)
          Returns a PropertyProxy suitable for the given instance and registers the selected PropertyProxy for the Class of the instance.
static PropertyProxyRegistry getRegistry()
          Returns the static or "application scope" PropertyProxy registry.
 void register(Class c, PropertyProxy proxy)
          Register a custom PropertyProxy for a Class.
static void release()
          Call this on Message broker shutdown ONLY.
 void unregister(Class c)
          Removes a custom PropertyProxy from the registry.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyProxyRegistry

public PropertyProxyRegistry()
Constructs an empty PropertyProxy registry.

Method Detail

getRegistry

public static PropertyProxyRegistry getRegistry()
Returns the static or "application scope" PropertyProxy registry. If custom sets of PropertyProxies are required in different scopes then new instances of PropertyProxyRegistry should be manually created, however these will not be used for serialization.

Returns:
The global PropertyProxy registry.

release

public static void release()
Call this on Message broker shutdown ONLY. Clears the registry and removes the static global registry.


getProxyAndRegister

public static PropertyProxy getProxyAndRegister(Object instance)
Returns a PropertyProxy suitable for the given instance and registers the selected PropertyProxy for the Class of the instance. Note that the PropertyProxy is not cloned so either the PropertyProxy should be used as a template else you must first call clone() on the returned PropertyProxy and then set the instance as the default on the resulting clone.

Parameters:
instance - the type to search for a suitable PropertyProxy.
Returns:
PropertyProxy suitable for the instance type.

getProxy

public static PropertyProxy getProxy(Object instance)
Returns a PropertyProxy suitable for the given instance but does not register the selected PropertyProxy for the Class of the instance. Note that the PropertyProxy is not cloned so either the PropertyProxy should be used as a template else you must first call clone() on the returned PropertyProxy and then set the instance as the default on the resulting clone.

Parameters:
instance - the type to search for a suitable PropertyProxy.
Returns:
PropertyProxy suitable for the instance type.

getProxy

public PropertyProxy getProxy(Class c)
Locates a custom PropertyProxy for the given Class. The entire class hierarchy is searched. Even if a match is found in the class heirarchy the PropertyProxy is not registered for the given Class.

Parameters:
c - the Class used to search the registry.
Returns:
the custom PropertyProxy registered for the Class or null if a PropertyProxy was not found or if the given Class is null.

getProxyAndRegister

public PropertyProxy getProxyAndRegister(Class c)
Locates a custom PropertyProxy for the given Class. The entire class hierarchy is searched. If a match is found in the class heirarchy the PropertyProxy is registered for the given class.

Parameters:
c - the Class used to search the registry.
Returns:
the custom PropertyProxy registered for the Class or null if a PropertyProxy was not found or if the given Class is null.

getProxy

public PropertyProxy getProxy(Class c,
                              boolean searchHierarchy,
                              boolean autoRegister)
Locates a custom PropertyProxy for the given Class. If the searchHierarchy argument is true the search starts by trying an exact Class match, then the immediate interfaces are tried in the order that they are declared on the Class and finally the process is repeated for the superclass, if one exists.

Parameters:
c - the Class used to search the registry.
searchHierarchy - if true the entire class hierarchy is searched.
autoRegister - if true a successful match is registerd for top level class
Returns:
the custom PropertyProxy registered for the Class or null if a PropertyProxy was not found or if the given Class is null.

clear

public void clear()
Removes all items from the class registry.


register

public void register(Class c,
                     PropertyProxy proxy)
Register a custom PropertyProxy for a Class.

Parameters:
c - The key for the class registry.
proxy - The custom PropertyProxy implementation.

unregister

public void unregister(Class c)
Removes a custom PropertyProxy from the registry.

Parameters:
c - The Class to be removed from the registry.


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/PropertyProxyRegistry.html