private <T, B extends T> void addAsRegistrationBean(
     ListableBeanFactory beanFactory,
     Class<T> type,
     Class<B> beanType,
     RegistrationBeanAdapter<T> adapter) {
   List<Map.Entry<String, B>> beans = getOrderedBeansOfType(beanFactory, beanType, this.seen);
   for (Entry<String, B> bean : beans) {
     if (this.seen.add(bean.getValue())) {
       int order = getOrder(bean.getValue());
       String beanName = bean.getKey();
       // One that we haven't already seen
       RegistrationBean registration =
           adapter.createRegistrationBean(beanName, bean.getValue(), beans.size());
       registration.setName(beanName);
       registration.setOrder(order);
       this.initializers.add(type, registration);
       if (this.log.isDebugEnabled()) {
         this.log.debug(
             "Created "
                 + type.getSimpleName()
                 + " initializer for bean '"
                 + beanName
                 + "'; order="
                 + order
                 + ", resource="
                 + getResourceDescription(beanName, beanFactory));
       }
     }
   }
 }
  public static User createUserFromRegistrationBean(RegistrationBean registrationBean) {
    User user = new User();

    user.setName(registrationBean.getName());
    user.setLastName(registrationBean.getLastName());
    user.setEmail(registrationBean.getEmail());
    user.setPassword(registrationBean.getPassword());
    user.setAvatarName(registrationBean.getAvatarName());

    return user;
  }