title: How to map Enum attribute into an Enum of another type with Mapstruct - Java
body: <p>I have two similar enums used respectively in Domain and Entity class.
  Here is an Example :</p>
  <p><em><strong>Classes</strong></em></p>
  <pre><code>public class Entity {
     String name;
     State state;
  }
  </code></pre>
  <pre><code>public class Domain {
     String name;
     Status status;
  }
  </code></pre>
  <pre><code>public enum Status {
     PENDING,
     CANCELLED
  }
  </code></pre>
  <pre><code>public enum State {
     PENDING,
     CANCELLED
  }
  </code></pre>
  <p><strong>Mappers</strong></p>
  <pre><code>public interface StatusMapper {
     public Status statusToState(Status status);
  }
  </code></pre>
  <pre><code>public interface EntityMapper {
     public Domain EntityToDomain(Entity entity);
  }
  </code></pre>
  <p>What do I have to do if I want to know how to map Entity to Domain so that :</p>
  <pre><code>Entity { name: &quot;Name&quot;, state: &quot;PENDING&quot; } 
  </code></pre>
  <p>becomes and maps into :</p>
  <pre><code>Domain { name: &quot;Name&quot;, status: &quot;PENDING&quot; }
  </code></pre>
  <p>You can see here that State and Status are the same. I have tested it but status becomes null when mapping Entity to Domain.</p>
  <p>Thanks for your answers.</p>