org.springframework.orm.hibernate3
Class TypeDefinitionBean

java.lang.Object
  extended by org.springframework.orm.hibernate3.TypeDefinitionBean
All Implemented Interfaces:
BeanNameAware, InitializingBean

public class TypeDefinitionBean
extends java.lang.Object
implements BeanNameAware, InitializingBean

Bean that encapsulates a Hibernate type definition.

Typically defined as inner bean within a LocalSessionFactoryBean definition, as list element for the "typeDefinitions" bean property. For example:

 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
   ...
   <property name="typeDefinitions">
     <list>
       <bean class="org.springframework.orm.hibernate3.TypeDefinitionBean">
         <property name="typeName" value="myType"/>
         <property name="typeClass" value="mypackage.MyTypeClass"/>
       </bean>
     </list>
   </property>
   ...
 </bean>
Alternatively, specify a bean id (or name) attribute for the inner bean, instead of the "typeName" property.

Since:
1.2
Author:
Juergen Hoeller
See Also:
LocalSessionFactoryBean.setTypeDefinitions(TypeDefinitionBean[])

Field Summary
private  java.util.Properties parameters
           
private  java.lang.String typeClass
           
private  java.lang.String typeName
           
 
Constructor Summary
TypeDefinitionBean()
           
 
Method Summary
 void afterPropertiesSet()
          Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
 java.util.Properties getParameters()
          Return the default parameters for the type.
 java.lang.String getTypeClass()
          Return the type implementation class.
 java.lang.String getTypeName()
          Return the name of the type.
 void setBeanName(java.lang.String name)
          If no explicit type name has been specified, the bean name of the TypeDefinitionBean will be used.
 void setParameters(java.util.Properties parameters)
          Specify default parameters for the type.
 void setTypeClass(java.lang.String typeClass)
          Set the type implementation class.
 void setTypeName(java.lang.String typeName)
          Set the name of the type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeName

private java.lang.String typeName

typeClass

private java.lang.String typeClass

parameters

private java.util.Properties parameters
Constructor Detail

TypeDefinitionBean

public TypeDefinitionBean()
Method Detail

setTypeName

public void setTypeName(java.lang.String typeName)
Set the name of the type.

See Also:
org.hibernate.cfg.Mappings#addTypeDef(String, String, java.util.Properties)

getTypeName

public java.lang.String getTypeName()
Return the name of the type.


setTypeClass

public void setTypeClass(java.lang.String typeClass)
Set the type implementation class.

See Also:
org.hibernate.cfg.Mappings#addTypeDef(String, String, java.util.Properties)

getTypeClass

public java.lang.String getTypeClass()
Return the type implementation class.


setParameters

public void setParameters(java.util.Properties parameters)
Specify default parameters for the type. This only applies to parameterized types.

See Also:
org.hibernate.cfg.Mappings#addTypeDef(String, String, java.util.Properties), org.hibernate.usertype.ParameterizedType

getParameters

public java.util.Properties getParameters()
Return the default parameters for the type.


setBeanName

public void setBeanName(java.lang.String name)
If no explicit type name has been specified, the bean name of the TypeDefinitionBean will be used.

Specified by:
setBeanName in interface BeanNameAware
Parameters:
name - the name of the bean in the factory. Note that this name is the actual bean name used in the factory, which may differ from the originally specified name: in particular for inner bean names, the actual bean name might have been made unique through appending "#..." suffixes. Use the BeanFactoryUtils.originalBeanName(String) method to extract the original bean name (without suffix), if desired.
See Also:
setTypeName(java.lang.String)

afterPropertiesSet

public void afterPropertiesSet()
Description copied from interface: InitializingBean
Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Specified by:
afterPropertiesSet in interface InitializingBean