net.sf.doolin.util
Class Enum2StringAdapter<E extends Enum<E>>

java.lang.Object
  extended by net.sf.doolin.util.Enum2StringAdapter<E>
Type Parameters:
E - Type of the enumeration.
All Implemented Interfaces:
Adapter<E,String>

public class Enum2StringAdapter<E extends Enum<E>>
extends Object
implements Adapter<E,String>

Adapter from a String to an enumeration.

Author:
Damien Coraboeuf

Constructor Summary
Enum2StringAdapter()
           
 
Method Summary
 String convertSubjectToTarget(E targetValue)
          Conversion from the subject to the target
 E convertTargetToSubject(String subjectValue)
          Conversion from the target to the subject
 void setEnumClass(Class<E> enumClass)
          Sets the enumeration class to use (required).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Enum2StringAdapter

public Enum2StringAdapter()
Method Detail

convertSubjectToTarget

public String convertSubjectToTarget(E targetValue)
Description copied from interface: Adapter
Conversion from the subject to the target

Specified by:
convertSubjectToTarget in interface Adapter<E extends Enum<E>,String>
Parameters:
targetValue - Subject value
Returns:
Target value

convertTargetToSubject

public E convertTargetToSubject(String subjectValue)
Description copied from interface: Adapter
Conversion from the target to the subject

Specified by:
convertTargetToSubject in interface Adapter<E extends Enum<E>,String>
Parameters:
subjectValue - Target value
Returns:
Subject value

setEnumClass

public void setEnumClass(Class<E> enumClass)
Sets the enumeration class to use (required).

Parameters:
enumClass - Enumeration class.


Copyright © 2011. All Rights Reserved.