added getTypeName() function in Element
This commit is contained in:
parent
a5f2953fe7
commit
b26681665e
|
@ -8,6 +8,7 @@ import java.io.StringWriter;
|
|||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.reference.Element;
|
||||
import org.gcube.informationsystem.serialization.ElementMapper;
|
||||
import org.gcube.informationsystem.utils.TypeUtility;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
|
@ -30,4 +31,10 @@ public class ElementImpl implements Element {
|
|||
return super.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return TypeUtility.getTypeName(this.getClass());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,4 +32,6 @@ public interface Element extends Serializable {
|
|||
*/
|
||||
public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss.SSS Z";
|
||||
|
||||
public String getTypeName();
|
||||
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl;
|
|||
import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.Type;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.gcube.informationsystem.utils.TypeUtility;
|
||||
import org.gcube.informationsystem.utils.Version;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -289,4 +290,9 @@ public class TypeImpl implements Type {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return TypeUtility.getTypeName(this.getClass());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
|||
import org.gcube.informationsystem.types.PropertyTypeName;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.gcube.informationsystem.utils.TypeUtility;
|
||||
import org.gcube.informationsystem.utils.Version;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -281,4 +282,9 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return TypeUtility.getTypeName(this.getClass());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,10 +24,6 @@ public class TypeUtility {
|
|||
return getTypeName(jsonNode);
|
||||
}
|
||||
|
||||
public static String getTypeName(Element element){
|
||||
return getTypeName(element.getClass());
|
||||
}
|
||||
|
||||
public static <E extends Element> String getTypeName(Class<E> clz){
|
||||
return TypeMapper.getType(clz);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue