org.apache.tapestry.internal.translator
Class IntegerTranslator

java.lang.Object
  extended by org.apache.tapestry.internal.translator.IntegerTranslator
All Implemented Interfaces:
Translator<Integer>

public final class IntegerTranslator
extends Object
implements Translator<Integer>

A translator for type integer.


Constructor Summary
IntegerTranslator()
           
 
Method Summary
 Class<Integer> getType()
          Returns the type of the server-side value.
 Integer parseClient(String clientValue, Messages messages)
          Parses blank values to null, otherwise parses the client value to an integer.
 String toClient(Integer value)
          Converts null to the blank string, non-null to a string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegerTranslator

public IntegerTranslator()
Method Detail

getType

public Class<Integer> getType()
Description copied from interface: Translator
Returns the type of the server-side value.

Specified by:
getType in interface Translator<Integer>
Returns:
a type

parseClient

public Integer parseClient(String clientValue,
                           Messages messages)
                    throws ValidationException
Parses blank values to null, otherwise parses the client value to an integer.

Specified by:
parseClient in interface Translator<Integer>
Parameters:
clientValue - to convert to a server value; this will not be null, but may be blank
messages - validator messages assembled by ValidationMessagesSource
Returns:
equivalent server-side value (possibly null)
Throws:
ValidationException - if the clientValue can not be parsed as an integer

toClient

public String toClient(Integer value)
Converts null to the blank string, non-null to a string representation.

Specified by:
toClient in interface Translator<Integer>
Parameters:
value - the server side value (which will not be null)
Returns:
client-side value to present to the user


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.