package org.marsik.elshelves.api.entities;

import java.util.UUID;

public class PolymorphicRecord extends AbstractEntityApiModel {
    String type;

    public PolymorphicRecord() {
    }

    public PolymorphicRecord(UUID id) {
        super(id);
    }

    public PolymorphicRecord(String id) {
        super(UUID.fromString(id));
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}

@@ -37,16 +37,67 @@
 ities;%0A%0A
+import org.marsik.elshelves.api.ember.EmberModel;%0A%0A
 import j
@@ -249,33 +249,23 @@
 lic 
-PolymorphicRecord(UUID id
+String getType(
 ) %7B%0A
@@ -276,17 +276,19 @@
     
-super(id)
+return type
 ;%0A  
@@ -307,33 +307,28 @@
 lic 
-PolymorphicRecord
+void setType
 (String 
 id) 
@@ -323,18 +323,20 @@
 (String 
-id
+type
 ) %7B%0A    
@@ -343,164 +343,278 @@
     
-super(UUID.fromString(id));%0A    %7D%0A%0A    public String getType() %7B%0A        return type
+this.type = type;%0A    %7D%0A%0A    public static PolymorphicRecord build(AbstractEntityApiModel entity) %7B%0A        PolymorphicRecord p = new PolymorphicRecord()
 ;%0A    
-%7D%0A%0A
     p
-ublic void setType(String type) %7B%0A        this.type = type
+.setType(EmberModel.getSingularName(entity.getClass()));%0A        p.setId(entity.getId());%0A        return p
 ;%0A  

Add builder to PolymorphicModel