Errai 3.0.1-SNAPSHOT

org.jboss.errai.databinding.client
Class BindableProxyFactory

java.lang.Object
  extended by org.jboss.errai.databinding.client.BindableProxyFactory

public class BindableProxyFactory
extends Object

Provides access to the generated proxies for Bindable types.

Author:
Christian Sadilek

Constructor Summary
BindableProxyFactory()
           
 
Method Summary
static void addBindableProxy(Class<?> proxyType, BindableProxyProvider proxyProvider)
          Registers a generated bindable proxy.
static
<T> T
getBindableProxy(Class<T> bindableType, InitialState state)
          Returns a proxy for a newly created model instance of the provided type.
static
<T> T
getBindableProxy(T model, InitialState state)
          Returns a new proxy for the provided model instance.
static
<T> boolean
isBindableType(T model)
          Checks if the type of the provided model is bindable.
static
<T> void
removeCachedProxyForModel(T model)
          Remove the cached proxy for the provided model instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BindableProxyFactory

public BindableProxyFactory()
Method Detail

getBindableProxy

public static <T> T getBindableProxy(T model,
                                     InitialState state)
Returns a new proxy for the provided model instance. Changes to the proxy's state will result in updates on the widget given the corresponding property was bound (see BindableProxy#bind(String, com.google.gwt.user.client.ui.HasValue)).

Type Parameters:
T - the bindable type
Parameters:
model - The model instance to proxy.
state - Specifies the origin of the initial state of both model and UI widget.
Returns:
proxy that can be used in place of the model instance.

getBindableProxy

public static <T> T getBindableProxy(Class<T> bindableType,
                                     InitialState state)
Returns a proxy for a newly created model instance of the provided type. Changes to the proxy's state will result in updates on the widget given the corresponding property was bound (see BindableProxy#bind(String, com.google.gwt.user.client.ui.HasValue)).

Parameters:
bindableType - the bindable type
state - Specifies the origin of the initial state of both model and UI widget.
Returns:
proxy that can be used in place of the model instance.

addBindableProxy

public static void addBindableProxy(Class<?> proxyType,
                                    BindableProxyProvider proxyProvider)
Registers a generated bindable proxy. This method is called by the generated BindableProxyLoader.

Parameters:
proxyType - The bindable type, must not be null.
proxyProvider - The proxy provider for the generated bindable proxy, must not be null.

removeCachedProxyForModel

public static <T> void removeCachedProxyForModel(T model)
Remove the cached proxy for the provided model instance. A future lookup will cause the creation of a new proxy instance.

Type Parameters:
T - the bindable type
Parameters:
model - the model instance

isBindableType

public static <T> boolean isBindableType(T model)
Checks if the type of the provided model is bindable. That's the case when a proxy provider has been generated for that type (the type has been annotated or configured to be bindable).

Parameters:
model - the object to be checked.
Returns:
true if the object is bindable, otherwise false.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.