org.squirrelframework.foundation.fsm
Class Converter.EnumConverter<T extends Enum<T>>

java.lang.Object
  extended by org.squirrelframework.foundation.fsm.Converter.EnumConverter<T>
Type Parameters:
T - enum type
All Implemented Interfaces:
SquirrelComponent, Converter<T>
Enclosing interface:
Converter<T>

public static class Converter.EnumConverter<T extends Enum<T>>
extends Object
implements Converter<T>

Enumeration converter which can convert Enum object to its name, and also convert Enum name to Enum object.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.squirrelframework.foundation.fsm.Converter
Converter.EnumConverter<T extends Enum<T>>
 
Constructor Summary
Converter.EnumConverter(Class<T> enumType)
           
 
Method Summary
 T convertFromString(String name)
          Convert string to object.
 String convertToString(T obj)
          Convert object to string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Converter.EnumConverter

public Converter.EnumConverter(Class<T> enumType)
Method Detail

convertToString

public String convertToString(T obj)
Description copied from interface: Converter
Convert object to string.

Specified by:
convertToString in interface Converter<T extends Enum<T>>
Parameters:
obj - converted object
Returns:
string description of object

convertFromString

public T convertFromString(String name)
Description copied from interface: Converter
Convert string to object.

Specified by:
convertFromString in interface Converter<T extends Enum<T>>
Parameters:
name - name of the object
Returns:
converted object


Copyright © 2013-2014. All Rights Reserved.