saperliu / hibernate-generic-dao

Automatically exported from code.google.com/p/hibernate-generic-dao
0 stars 0 forks source link

Add Enumeration support to InternalUtil.convertIfNeeded() #103

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This method currently doesn't support any method of coercing values into 
enumerations.

would you mind adding something like:

if(type.isEnum() && value instanceof String ) {
  return Enum.valueOf((Class<? extends Enum>) type, (String) value);
}

or fancier at at your leisure somewhere at the top of this method?

As an aside, I like your library a lot, but the internal static singleton 
factory nature of a some of the classes combined with private constructors, 
make this library hard to extend and adapt (e.g HibernateSearchProcessor, 
HibernateMetadataUtil and more) would you mind making them more Spring wiring 
friendly?

Original issue reported on code.google.com by barrett....@gmail.com on 1 May 2013 at 5:05