import com.training.mapstrut.model.employee;
import com.training.mapstrut.model.user;
import javax.annotation.generated;
@generated(
value = "org.mapstruct.ap.mappingprocessor",
date = "2017-08-26t17:08:23+0800",
comments = "version: 1.2.0.cr1, compiler: javac, environment: java 1.8.0_92 (oracle corporation)"
)
public class usermapperimpl implements usermapper {
@override
public employee usertoemployee(user user) {
if ( user == null ) {
return null;
}
employee employee = new employee();
employee.setid( user.getid() );
employee.setname( user.getname() );
employee.setmarried( user.ismarried() );
return employee;
}
@override
public user employeetouser(employee employee) {
if ( employee == null ) {
return null;
}
user user = new user();
user.setid( employee.getid() );
user.setname( employee.getname() );
user.setmarried( employee.ismarried() );
return user;
}
}
简单的写个测试类实验一下。
public class apptest{
@test
public void apptest(){
user user = new user();
user.setid(125);
user.setname("chao");
user.setmarried(false);
employee e = usermapper.instance.usertoemployee(user);
system.out.println(e);
assert.assertfalse(e.ismarried());
}
}