站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 3.2.4 正式版 API 英文文档

Tuplizer (Hibernate API Documentation) - Hibernate 3.2.4 正式版 API 英文文档


org.hibernate.tuple
Interface Tuplizer

All Known Subinterfaces:
ComponentTuplizer, EntityTuplizer
All Known Implementing Classes:
AbstractComponentTuplizer, AbstractEntityTuplizer

public interface Tuplizer

A tuplizer defines the contract for things which know how to manage a particular representation of a piece of data, given that representation's EntityMode (the entity-mode essentially defining which representation).

If that given piece of data is thought of as a data structure, then a tuplizer is the thing which knows how to

For example, a given piece of data might be represented as a POJO class. Here, it's representation and entity-mode is POJO. Well a tuplizer for POJO entity-modes would know how to

That same piece of data might also be represented as a DOM structure, using the tuplizer associated with the DOM4J entity-mode, which would generate instances of Element as the data structure and know how to access the values as either nested Elements or as Attributes.

Author:
Steve Ebersole
See Also:
EntityTuplizer, ComponentTuplizer

Method Summary
 Class getMappedClass()
          Return the pojo class managed by this tuplizer.
 Object getPropertyValue(Object entity, int i)
          Extract the value of a particular property from the given entity.
 Object[] getPropertyValues(Object entity)
          Extract the current values contained on the given entity.
 Object instantiate()
          Generate a new, empty entity.
 boolean isInstance(Object object)
          Is the given object considered an instance of the the entity (acconting for entity-mode) managed by this tuplizer.
 void setPropertyValues(Object entity, Object[] values)
          Inject the given values into the given entity.
 

Method Detail

getPropertyValues

public Object[] getPropertyValues(Object entity)
                           throws HibernateException
Extract the current values contained on the given entity.

Parameters:
entity - The entity from which to extract values.
Returns:
The current property values.
Throws:
HibernateException

setPropertyValues

public void setPropertyValues(Object entity,
                              Object[] values)
                       throws HibernateException
Inject the given values into the given entity.

Parameters:
entity - The entity.
values - The values to be injected.
Throws:
HibernateException

getPropertyValue

public Object getPropertyValue(Object entity,
                               int i)
                        throws HibernateException
Extract the value of a particular property from the given entity.

Parameters:
entity - The entity from which to extract the property value.
i - The index of the property for which to extract the value.
Returns:
The current value of the given property on the given entity.
Throws:
HibernateException

instantiate

public Object instantiate()
                   throws HibernateException
Generate a new, empty entity.

Returns:
The new, empty entity instance.
Throws:
HibernateException

isInstance

public boolean isInstance(Object object)
Is the given object considered an instance of the the entity (acconting for entity-mode) managed by this tuplizer.

Parameters:
object - The object to be checked.
Returns:
True if the object is considered as an instance of this entity within the given mode.

getMappedClass

public Class getMappedClass()
Return the pojo class managed by this tuplizer.

Need to determine how to best handle this for the Tuplizers for EntityModes other than POJO.

todo : be really nice to not have this here since it is essentially pojo specific...

Returns:
The persistent class.