br.com.objectos.way.etc.model.UserLoader Maven / Gradle / Ivy
The newest version!
/*
* UserLoader.java criado em 07/09/2012
*
* Propriedade de Objectos Fábrica de Software LTDA.
* Reprodução parcial ou total proibida.
*/
package br.com.objectos.way.etc.model;
import br.com.objectos.way.etc.EtcLoader;
import br.com.objectos.way.etc.Mapping;
/**
* @author [email protected] (Marcio Endo)
*/
public enum UserLoader implements EtcLoader {
INSTANCE;
@Override
public User load(Mapping map) {
return new UserBuilder(map).build();
}
private class UserBuilder implements User.Builder {
private final Mapping map;
public UserBuilder(Mapping map) {
this.map = map;
}
@Override
public User build() {
return new User(this);
}
@Override
public String getName() {
return map.getString("name");
}
@Override
public String getEmail() {
return map.getString("email");
}
}
}