extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/converter/IdentityConverter.java

Code
Comments
Other
Rev Date Author Line
1333 05 Apr 11 nicklas 1 package net.sf.basedb.reggie.converter;
1333 05 Apr 11 nicklas 2
1333 05 Apr 11 nicklas 3 /**
1333 05 Apr 11 nicklas 4   Value converter implementation that simply returns the orginal
1333 05 Apr 11 nicklas 5   object.
1333 05 Apr 11 nicklas 6   @author nicklas
1333 05 Apr 11 nicklas 7   @since 1.2
1333 05 Apr 11 nicklas 8 */
1333 05 Apr 11 nicklas 9 public class IdentityConverter<T>
1333 05 Apr 11 nicklas 10   implements ValueConverter<T, T>
1333 05 Apr 11 nicklas 11 {
1333 05 Apr 11 nicklas 12
1333 05 Apr 11 nicklas 13   /**
1333 05 Apr 11 nicklas 14     The one and only instance of this class.
1333 05 Apr 11 nicklas 15   */
3572 02 Nov 15 nicklas 16   public static final IdentityConverter<Object> INSTANCE = new IdentityConverter<Object>();
1333 05 Apr 11 nicklas 17   
4567 01 Sep 17 nicklas 18   public IdentityConverter()
1333 05 Apr 11 nicklas 19   {}
1333 05 Apr 11 nicklas 20   
1333 05 Apr 11 nicklas 21   /*
1333 05 Apr 11 nicklas 22     From the ValueConverter interface
1333 05 Apr 11 nicklas 23     ---------------------------------
1333 05 Apr 11 nicklas 24   */
1333 05 Apr 11 nicklas 25   @Override
1333 05 Apr 11 nicklas 26   public T convert(T value) 
1333 05 Apr 11 nicklas 27   {
1333 05 Apr 11 nicklas 28     return value;
1333 05 Apr 11 nicklas 29   }
1333 05 Apr 11 nicklas 30   // ----------------------------------
1333 05 Apr 11 nicklas 31   
1333 05 Apr 11 nicklas 32 }