org.tynamo.jdo.internal
Class JDOEntityValueEncoder<E>

java.lang.Object
  extended by org.tynamo.jdo.internal.JDOEntityValueEncoder<E>
All Implemented Interfaces:
org.apache.tapestry5.ValueEncoder<E>

public final class JDOEntityValueEncoder<E>
extends Object
implements org.apache.tapestry5.ValueEncoder<E>

A simple implementation of an ValueEncoder for JDO objects with a simple primary key.

This implementation is registered by default for all JDO persistent objects; however, if the JDOs in the application use complex primary keys or custom object IDs then they will likely need to use a different value encoder


Constructor Summary
JDOEntityValueEncoder(Class<E> pcClass, javax.jdo.PersistenceManager pm, org.apache.tapestry5.ioc.services.PropertyAccess propertyAccess, org.apache.tapestry5.ioc.services.TypeCoercer typeCoercer, org.slf4j.Logger logger)
          Creates a new JDOEntityValueEncoder object.
 
Method Summary
 String toClient(E value)
          Encodes the ID of the field marked with javax.jdo.annotations.PrimaryKey as a string.
 E toValue(String clientValue)
          Decodes the primary key value to an actual JDO object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDOEntityValueEncoder

public JDOEntityValueEncoder(Class<E> pcClass,
                             javax.jdo.PersistenceManager pm,
                             org.apache.tapestry5.ioc.services.PropertyAccess propertyAccess,
                             org.apache.tapestry5.ioc.services.TypeCoercer typeCoercer,
                             org.slf4j.Logger logger)
Creates a new JDOEntityValueEncoder object.

Parameters:
pcClass - Class for entity
pm - PersistenceManager to use
propertyAccess - PropertyAccess from tapestry
typeCoercer - typeCoercer from tapestry
logger - Logger to use
Method Detail

toClient

public String toClient(E value)
Encodes the ID of the field marked with javax.jdo.annotations.PrimaryKey as a string.

Specified by:
toClient in interface org.apache.tapestry5.ValueEncoder<E>
Parameters:
the - string value of the ID
Returns:

toValue

public E toValue(String clientValue)
Decodes the primary key value to an actual JDO object

Specified by:
toValue in interface org.apache.tapestry5.ValueEncoder<E>
Parameters:
the - value coming from the client
Returns:
the full blown JDO object


Copyright © 2011-2012. All Rights Reserved.