org.directwebremoting.spring
Class BeanCreator

java.lang.Object
  extended by org.directwebremoting.extend.AbstractCreator
      extended by org.directwebremoting.spring.BeanCreator
All Implemented Interfaces:
Creator, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

public class BeanCreator
extends AbstractCreator
implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

A creator that proxies to the specified bean.
Note that it can be configured with additional include rules, exclude rules, filters and authentication rules using the specified creator configuration.

Author:
Bram Smeets
See Also:
CreatorConfig

Field Summary
 
Fields inherited from interface org.directwebremoting.extend.Creator
APPLICATION, PAGE, REQUEST, SCRIPT, SESSION
 
Constructor Summary
BeanCreator()
           
 
Method Summary
 void afterPropertiesSet()
          Is called by the Spring container after all properties have been set.
 CreatorConfig getConfig()
          Gets the configuration for this creator.
 java.lang.Object getInstance()
          Accessor for the instance of this creator.
 java.lang.Class<?> getType()
          Accessor for the class that this creator allows access to.
 void setBean(java.lang.Object bean)
          Sets the bean for this bean creator.
 void setBeanClass(java.lang.Class<?> beanClass)
          Sets the bean class for this creator.
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
          Sets the bean factory that contains this BeanCreator.
 void setBeanId(java.lang.String beanId)
          Sets the id of the bean to remote using DWR.
 void setConfig(CreatorConfig config)
          Sets the configuration for this creator.
 
Methods inherited from class org.directwebremoting.extend.AbstractCreator
getJavascript, getScope, isCacheable, isHidden, setCacheable, setHidden, setJavascript, setProperties, setScope, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanCreator

public BeanCreator()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
Is called by the Spring container after all properties have been set.
It is implemented in order to initialize the beanClass field correctly and to make sure that either the bean id or the bean itself have been set on this creator.

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
See Also:
InitializingBean

getType

public java.lang.Class<?> getType()
Accessor for the class that this creator allows access to.
It returns the class specified by the beanClass property. In case no class name has been set, it returns the class of the specified bean.

Specified by:
getType in interface Creator
Returns:
the type of this allowed class

getInstance

public java.lang.Object getInstance()
Accessor for the instance of this creator.
It returns the specified bean property.

Specified by:
getInstance in interface Creator
Returns:
the bean instance of this creator

setBean

public void setBean(java.lang.Object bean)
Sets the bean for this bean creator.

Parameters:
bean - the bean for this creator

setBeanClass

public void setBeanClass(java.lang.Class<?> beanClass)
Sets the bean class for this creator.
Use this property to specify a different class or interface for instance in case the specified bean is a proxy or implementation and we want to expose the interface.

Parameters:
beanClass - the class of the bean to remote

setBeanId

public void setBeanId(java.lang.String beanId)
Sets the id of the bean to remote using DWR.
Either set this property on the creator, or set the bean to be remoted directly on this creator.

Parameters:
beanId - the id of the bean to remote

setConfig

public void setConfig(CreatorConfig config)
Sets the configuration for this creator.
Use the configuration to specify include and exclude rules, filters and/or authentication rules.

Parameters:
config - the configuration for this creator
See Also:
CreatorConfig

getConfig

public CreatorConfig getConfig()
Gets the configuration for this creator.

Returns:
the configuration for this creator

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                    throws org.springframework.beans.BeansException
Sets the bean factory that contains this BeanCreator.

Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Parameters:
beanFactory - the beanFactory that created this BeanCreator
Throws:
org.springframework.beans.BeansException
See Also:
BeanFactoryAware.setBeanFactory(org.springframework.beans.factory.BeanFactory)

Copyright 2008