I have two similar enums used respectively in Domain and Entity class. Here is an Example :
Classes
public class Entity {
String name;
State state;
}
public class Domain {
String name;
Status status;
}
public enum Status {
PENDING,
CANCELLED
}
public enum State {
PENDING,
CANCELLED
}
Mappers
public interface StatusMapper {
public Status statusToState(Status status);
}
public interface EntityMapper {
public Domain EntityToDomain(Entity entity);
}
What do I have to do if I want to know how to map Entity to Domain so that :
Entity { name: "Name", state: "PENDING" }
becomes and maps into :
Domain { name: "Name", status: "PENDING" }
You can see here that State and Status are the same. I have tested it but status becomes null when mapping Entity to Domain.
Thanks for your answers.
statusToState(Status status)should return a State? am i wrong?