se.unlogic.standardutils.populators
Class EnumPopulator<EnumType extends Enum<EnumType>>

java.lang.Object
  extended by se.unlogic.standardutils.populators.BaseStringPopulator<EnumType>
      extended by se.unlogic.standardutils.populators.EnumPopulator<EnumType>
All Implemented Interfaces:
BeanResultSetPopulator<EnumType>, BeanStringPopulator<EnumType>, QueryParameterPopulator<EnumType>, StringFormatValidator

public class EnumPopulator<EnumType extends Enum<EnumType>>
extends BaseStringPopulator<EnumType>
implements BeanResultSetPopulator<EnumType>, BeanStringPopulator<EnumType>, QueryParameterPopulator<EnumType>


Field Summary
protected  Class<EnumType> classType
           
protected  String fieldName
           
 
Constructor Summary
EnumPopulator(Class<EnumType> classType)
           
EnumPopulator(Class<EnumType> classType, String fieldName)
           
 
Method Summary
static
<Type extends Enum<Type>>
EnumPopulator<Type>
getGenericInstance(Class<Type> type)
           
static EnumPopulator<?> getInstanceFromField(Field field)
           
static EnumPopulator<?> getInstanceFromListField(Field field)
           
static BeanStringPopulator<?> getInstanceFromListMethod(Method method)
           
static EnumPopulator<?> getInstanceFromMethod(Method method)
           
 Class<? extends EnumType> getType()
           
 EnumType getValue(String value)
           
 void populate(PreparedStatementQuery query, int paramIndex, Object bean)
           
 EnumType populate(ResultSet rs)
           
 boolean validateDefaultFormat(String value)
           
 
Methods inherited from class se.unlogic.standardutils.populators.BaseStringPopulator
getPopulatorID, validateFormat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface se.unlogic.standardutils.populators.BeanStringPopulator
getPopulatorID
 
Methods inherited from interface se.unlogic.standardutils.validation.StringFormatValidator
validateFormat
 

Field Detail

classType

protected Class<EnumType extends Enum<EnumType>> classType

fieldName

protected String fieldName
Constructor Detail

EnumPopulator

public EnumPopulator(Class<EnumType> classType)

EnumPopulator

public EnumPopulator(Class<EnumType> classType,
                     String fieldName)
Method Detail

populate

public EnumType populate(ResultSet rs)
                                         throws SQLException
Specified by:
populate in interface BeanResultSetPopulator<EnumType extends Enum<EnumType>>
Throws:
SQLException

getValue

public EnumType getValue(String value)
Specified by:
getValue in interface BeanStringPopulator<EnumType extends Enum<EnumType>>

validateDefaultFormat

public boolean validateDefaultFormat(String value)
Specified by:
validateDefaultFormat in class BaseStringPopulator<EnumType extends Enum<EnumType>>

getType

public Class<? extends EnumType> getType()
Specified by:
getType in interface BeanStringPopulator<EnumType extends Enum<EnumType>>
Specified by:
getType in interface QueryParameterPopulator<EnumType extends Enum<EnumType>>

populate

public void populate(PreparedStatementQuery query,
                     int paramIndex,
                     Object bean)
              throws SQLException
Specified by:
populate in interface QueryParameterPopulator<EnumType extends Enum<EnumType>>
Throws:
SQLException

getGenericInstance

public static <Type extends Enum<Type>> EnumPopulator<Type> getGenericInstance(Class<Type> type)

getInstanceFromField

public static EnumPopulator<?> getInstanceFromField(Field field)

getInstanceFromListField

public static EnumPopulator<?> getInstanceFromListField(Field field)

getInstanceFromMethod

public static EnumPopulator<?> getInstanceFromMethod(Method method)

getInstanceFromListMethod

public static BeanStringPopulator<?> getInstanceFromListMethod(Method method)


Copyright © 2011. All Rights Reserved.