Map<String, BindHandler> bindMap = new LinkedHashMap<String, BindHandler>();
Map<String, Converter> converterMap = new LinkedHashMap<String, Converter>();
Class thisClass = thisBean.getClass();
ConversionHandler conversionHandler = new DefaultConversionHandler();
for (Method getterMethod : thisClass.getMethods())
{
Annotation[] annotations = getterMethod.getAnnotations();
for (Annotation annotation : annotations)
{
Class<? extends Annotation> annotationType = annotation.annotationType();
BindFactoryClass factoryClass = annotationType.getAnnotation(BindFactoryClass.class);
if (factoryClass != null)
{
checkMethodIsGetter(getterMethod, annotationType);
String getterName = getterMethod.getName();
String thisPropertyName = ReflectHelper.getPropertyName(getterName);
// check for an explicitly named converter
ConverterReader converterReader = new ConverterReader();
Converter explicitConverter = converterReader.readConverter(getterMethod);
// create factory
BindHandlerFactory factory = ReflectHelper.createInstance(factoryClass.value(),
BindHandlerFactory.class);
// use factory to create handler and register this
BindHandler handler = factory.createHandler(annotation, getterMethod, explicitConverter,
conversionHandler);
Class converterClass = null;
if (explicitConverter != null)
{
converterClass = explicitConverter.getClass();
}
else
{
converterClass = handler.getConverter().getClass();
}
checkActualConverter(thisPropertyName, getterMethod, converterClass);
bindMap.put(thisPropertyName, handler);
converterMap.put(thisPropertyName, handler.getConverter());
}
}
}
BindConvertInfo bci = new BindConvertInfo(bindMap, converterMap, new DefaultConversionHandler());
return bci;
}