private <T> String exportDataAccordingFieldAnnotation(T fixedFormatRecord, Method method, Field fieldAnno) {
String result;
Class datatype = getDatatype(method, fieldAnno);
FormatContext context = getFormatContext(datatype, fieldAnno);
FixedFormatter formatter = getFixedFormatterInstance(context.getFormatter(), context);
FormatInstructions formatdata = getFormatInstructions(method, fieldAnno);
Object valueObject;
try {
valueObject = method.invoke(fixedFormatRecord);
} catch (Exception e) {
throw new FixedFormatException(format("could not invoke method %s.%s(%s)", fixedFormatRecord.getClass().getName(), method.getName(), datatype), e);
}
result = formatter.format(valueObject, formatdata);
if (LOG.isDebugEnabled()) {
LOG.debug(format("exported %s ", result));
}
return result;
}