private Type getType(Class<?> cl, String propertyName) throws NoSuchMethodException {
   try {
     Field field = cl.getDeclaredField(propertyName);
     return typeFactory.create(field.getType(), field.getGenericType());
   } catch (NoSuchFieldException e) {
     String getter = "get" + BeanUtils.capitalize(propertyName);
     String bgetter = "is" + BeanUtils.capitalize(propertyName);
     for (Method method : cl.getDeclaredMethods()) {
       if ((method.getName().equals(getter) || method.getName().equals(bgetter))
           && method.getParameterTypes().length == 0) {
         return typeFactory.create(method.getReturnType(), method.getGenericReturnType());
       }
     }
     if (cl.getSuperclass().equals(Object.class)) {
       throw new IllegalArgumentException(
           "No property found for " + cl.getName() + "." + propertyName);
     } else {
       return getType(cl.getSuperclass(), propertyName);
     }
   }
 }
 public HibernateDomainExporter(
     String namePrefix,
     String nameSuffix,
     File targetFolder,
     SerializerConfig serializerConfig,
     Configuration configuration) {
   this.targetFolder = targetFolder;
   this.serializerConfig = serializerConfig;
   this.configuration = configuration;
   CodegenModule module = new CodegenModule();
   module.bind(CodegenModule.PREFIX, namePrefix);
   module.bind(CodegenModule.SUFFIX, nameSuffix);
   module.bind(CodegenModule.KEYWORDS, Constants.keywords);
   this.queryTypeFactory = module.get(QueryTypeFactory.class);
   this.typeMappings = module.get(TypeMappings.class);
   this.embeddableSerializer = module.get(EmbeddableSerializer.class);
   this.entitySerializer = module.get(EntitySerializer.class);
   this.supertypeSerializer = module.get(SupertypeSerializer.class);
   typeFactory.setUnknownAsEntity(true);
 }