Fixed type definition

This commit is contained in:
Luca Frosini 2020-01-23 17:14:44 +01:00
parent 1421a53b52
commit c289601f6f
18 changed files with 319 additions and 146 deletions

View File

@ -11,6 +11,7 @@ import org.gcube.informationsystem.base.reference.ISManageable;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.BaseProperty;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.BaseRelation;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
@ -45,6 +46,8 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
protected boolean abstractType; protected boolean abstractType;
protected Set<String> superClasses; protected Set<String> superClasses;
protected Set<PropertyDefinition> properties;
protected <ISM extends ISManageable> Set<String> retrieveSuperClasses(Class<? extends ISM> type, Class<ISM> baseClass, String topSuperClass){ protected <ISM extends ISManageable> Set<String> retrieveSuperClasses(Class<? extends ISM> type, Class<ISM> baseClass, String topSuperClass){
Set<String> interfaceList = new HashSet<>(); Set<String> interfaceList = new HashSet<>();
@ -108,7 +111,7 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
typeDefinition = EntityTypeDefinitionImpl.getEntityTypeDefinitionInstance((Class<? extends BaseEntity>) clz); typeDefinition = EntityTypeDefinitionImpl.getEntityTypeDefinitionInstance((Class<? extends BaseEntity>) clz);
return typeDefinition; return typeDefinition;
} else if(BaseRelation.class.isAssignableFrom(clz)){ } else if(BaseRelation.class.isAssignableFrom(clz)){
typeDefinition = new RelationTypeDefinitionImpl((Class<? extends BaseRelation<?,?>>) clz); typeDefinition = RelationTypeDefinitionImpl.getRelationTypeDefinitionInstance((Class<? extends BaseRelation<?,?>>) clz);
return typeDefinition; return typeDefinition;
} else if(BaseProperty.class.isAssignableFrom(clz)){ } else if(BaseProperty.class.isAssignableFrom(clz)){
typeDefinition = new PropertyTypeDefinitionImpl(clz); typeDefinition = new PropertyTypeDefinitionImpl(clz);
@ -137,6 +140,10 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
this.abstractType = true; this.abstractType = true;
} }
if(!Resource.class.isAssignableFrom(clz)) {
this.properties = retrieveListOfProperties(clz);
}
} }
@Override @Override
@ -159,4 +166,9 @@ public class TypeDefinitionImpl extends ERImpl implements TypeDefinition {
return superClasses; return superClasses;
} }
@Override
public Set<PropertyDefinition> getProperties() {
return properties;
}
} }

View File

@ -13,6 +13,9 @@ import org.gcube.informationsystem.utils.ISMapper;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@JsonTypeName(value=EntityTypeDefinition.NAME) @JsonTypeName(value=EntityTypeDefinition.NAME)
public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements EntityTypeDefinition { public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements EntityTypeDefinition {
@ -24,21 +27,16 @@ public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements Enti
// private static final String VERTEX_CLASS_NAME = "V"; // private static final String VERTEX_CLASS_NAME = "V";
public static EntityTypeDefinition getEntityTypeDefinitionInstance(Class<? extends BaseEntity> clz) { public static EntityTypeDefinition getEntityTypeDefinitionInstance(Class<? extends BaseEntity> clz) {
EntityTypeDefinition entityTypeDefinition;
if(Resource.class.isAssignableFrom(clz)) { if(Resource.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends Resource> c = (Class<? extends Resource>) clz; Class<? extends Resource> c = (Class<? extends Resource>) clz;
entityTypeDefinition = new ResourceTypeDefinitionImpl(c); return new ResourceTypeDefinitionImpl((Class<? extends Resource>) c);
return entityTypeDefinition;
} else if(Facet.class.isAssignableFrom(clz)){ } else if(Facet.class.isAssignableFrom(clz)){
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Class<? extends Facet> c = (Class<? extends Facet>) clz; Class<? extends Facet> c = (Class<? extends Facet>) clz;
entityTypeDefinition = new FacetTypeDefinitionImpl(c); return new FacetTypeDefinitionImpl(c);
return entityTypeDefinition;
} else {
entityTypeDefinition = new EntityTypeDefinitionImpl(clz);
} }
return entityTypeDefinition; return new EntityTypeDefinitionImpl(clz);
} }
@ -62,7 +60,6 @@ public class EntityTypeDefinitionImpl extends TypeDefinitionImpl implements Enti
} else { } else {
throw new RuntimeException("Type Hierachy Error for class " + clz.getSimpleName()); throw new RuntimeException("Type Hierachy Error for class " + clz.getSimpleName());
} }
} }

View File

@ -1,14 +1,14 @@
package org.gcube.informationsystem.types.impl.entities; package org.gcube.informationsystem.types.impl.entities;
import java.util.Set;
import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@JsonTypeName(value=FacetTypeDefinition.NAME) @JsonTypeName(value=FacetTypeDefinition.NAME)
public class FacetTypeDefinitionImpl extends EntityTypeDefinitionImpl implements FacetTypeDefinition { public class FacetTypeDefinitionImpl extends EntityTypeDefinitionImpl implements FacetTypeDefinition {
@ -17,8 +17,6 @@ public class FacetTypeDefinitionImpl extends EntityTypeDefinitionImpl implements
*/ */
private static final long serialVersionUID = 6268161046955738969L; private static final long serialVersionUID = 6268161046955738969L;
protected Set<PropertyDefinition> properties;
protected FacetTypeDefinitionImpl() { protected FacetTypeDefinitionImpl() {
super(); super();
} }
@ -26,14 +24,8 @@ public class FacetTypeDefinitionImpl extends EntityTypeDefinitionImpl implements
public FacetTypeDefinitionImpl(Class<? extends Facet> clz) { public FacetTypeDefinitionImpl(Class<? extends Facet> clz) {
super(clz); super(clz);
Class<? extends Facet> c = (Class<? extends Facet>) clz; this.superClasses = retrieveSuperClasses(clz, Facet.class, Entity.NAME);
this.superClasses = retrieveSuperClasses(c, Facet.class, Entity.NAME);
this.properties = retrieveListOfProperties(clz);
} }
@Override
public Set<PropertyDefinition> getProperties() {
return properties;
}
} }

View File

@ -3,6 +3,7 @@ package org.gcube.informationsystem.types.impl.entities;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.annotations.ResourceSchema; import org.gcube.informationsystem.types.annotations.ResourceSchema;
@ -14,6 +15,9 @@ import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefin
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@JsonTypeName(value=ResourceTypeDefinition.NAME) @JsonTypeName(value=ResourceTypeDefinition.NAME)
public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl implements ResourceTypeDefinition { public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl implements ResourceTypeDefinition {
@ -31,6 +35,9 @@ public class ResourceTypeDefinitionImpl extends EntityTypeDefinitionImpl impleme
public ResourceTypeDefinitionImpl(Class<? extends Resource> clz) { public ResourceTypeDefinitionImpl(Class<? extends Resource> clz) {
super(clz); super(clz);
this.superClasses = retrieveSuperClasses(clz, Resource.class, Entity.NAME);
setResourceSchemaEntries(clz); setResourceSchemaEntries(clz);
} }

View File

@ -1,10 +1,7 @@
package org.gcube.informationsystem.types.impl.properties; package org.gcube.informationsystem.types.impl.properties;
import java.util.Set;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.BaseProperty;
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
@ -18,8 +15,6 @@ public final class PropertyTypeDefinitionImpl<P extends BaseProperty> extends Ty
*/ */
private static final long serialVersionUID = 7532701373450638829L; private static final long serialVersionUID = 7532701373450638829L;
protected Set<PropertyDefinition> properties;
protected PropertyTypeDefinitionImpl() { protected PropertyTypeDefinitionImpl() {
super(); super();
} }
@ -28,12 +23,6 @@ public final class PropertyTypeDefinitionImpl<P extends BaseProperty> extends Ty
super(clz); super(clz);
this.superClasses = retrieveSuperClasses(clz, BaseProperty.class, this.superClasses = retrieveSuperClasses(clz, BaseProperty.class,
clz == BaseProperty.class ? null : BaseProperty.NAME); clz == BaseProperty.class ? null : BaseProperty.NAME);
this.properties = retrieveListOfProperties(clz);
}
@Override
public Set<PropertyDefinition> getProperties() {
return properties;
} }
} }

View File

@ -0,0 +1,60 @@
package org.gcube.informationsystem.types.impl.relations;
import java.lang.reflect.Type;
import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.impl.entities.FacetTypeDefinitionImpl;
import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@JsonTypeName(value=ConsistsOfTypeDefinition.NAME)
public class ConsistsOfTypeDefinitionImpl extends RelationTypeDefinitionImpl<ResourceTypeDefinition, FacetTypeDefinition> implements ConsistsOfTypeDefinition {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 2891976493165330476L;
protected ConsistsOfTypeDefinitionImpl() {
super();
}
public ConsistsOfTypeDefinitionImpl(Class<? extends ConsistsOf<? extends Resource, ? extends Facet>> clz) {
super(clz);
this.superClasses = retrieveSuperClasses(clz, ConsistsOf.class, Relation.NAME);
this.properties = retrieveListOfProperties(clz);
discoverSourceAndTarget(clz);
}
@SuppressWarnings("unchecked")
private void discoverSourceAndTarget(Class<? extends ConsistsOf<? extends Resource, ? extends Facet>> clz) {
Type[] typeParameters = clz.getTypeParameters();
Class<? extends Resource> sourceClass;
Class<? extends Facet> targetClass;
if(typeParameters.length==0) {
typeParameters = getParametersFromSuperClasses(clz);
sourceClass = (Class<? extends Resource>) typeParameters[0];
targetClass = (Class<? extends Facet>) typeParameters[1];
}else {
sourceClass = (Class<? extends Resource>) getGenericClass(typeParameters[0]);
targetClass = (Class<? extends Facet>) getGenericClass(typeParameters[1]);
}
this.source = new ResourceTypeDefinitionImpl((Class<? extends Resource>) sourceClass);
this.target = new FacetTypeDefinitionImpl((Class<? extends Facet>) targetClass);
}
}

View File

@ -0,0 +1,57 @@
package org.gcube.informationsystem.types.impl.relations;
import java.lang.reflect.Type;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.impl.entities.ResourceTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@JsonTypeName(value=IsRelatedToTypeDefinition.NAME)
public class IsRelatedToTypeDefinitionImpl extends RelationTypeDefinitionImpl<ResourceTypeDefinition, ResourceTypeDefinition> implements IsRelatedToTypeDefinition {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 8448665395204514722L;
protected IsRelatedToTypeDefinitionImpl() {
super();
}
public IsRelatedToTypeDefinitionImpl(Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>> clz) {
super(clz);
this.superClasses = retrieveSuperClasses(clz, IsRelatedTo.class, Relation.NAME);
this.properties = retrieveListOfProperties(clz);
discoverSourceAndTarget(clz);
}
@SuppressWarnings("unchecked")
private void discoverSourceAndTarget(Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>> clz) {
Type[] typeParameters = clz.getTypeParameters();
Class<? extends Resource> sourceClass;
Class<? extends Resource> targetClass;
if(typeParameters.length==0) {
typeParameters = getParametersFromSuperClasses(clz);
sourceClass = (Class<? extends Resource>) typeParameters[0];
targetClass = (Class<? extends Resource>) typeParameters[1];
}else {
sourceClass = (Class<? extends Resource>) getGenericClass(typeParameters[0]);
targetClass = (Class<? extends Resource>) getGenericClass(typeParameters[1]);
}
this.source = new ResourceTypeDefinitionImpl((Class<? extends Resource>) sourceClass);
this.target = new ResourceTypeDefinitionImpl((Class<? extends Resource>) targetClass);
}
}

View File

@ -2,7 +2,6 @@ package org.gcube.informationsystem.types.impl.relations;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.util.Set;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.BaseRelation;
@ -11,42 +10,45 @@ import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.impl.TypeDefinitionImpl; import org.gcube.informationsystem.types.impl.TypeDefinitionImpl;
import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonTypeName;
@JsonTypeName(value = RelationTypeDefinition.NAME) @JsonTypeName(value = RelationTypeDefinition.NAME)
public final class RelationTypeDefinitionImpl extends TypeDefinitionImpl implements RelationTypeDefinition { public class RelationTypeDefinitionImpl<S extends EntityTypeDefinition, T extends EntityTypeDefinition>
extends TypeDefinitionImpl implements RelationTypeDefinition<S,T> {
/** /**
* Generated Serial Version UID * Generated Serial Version UID
*/ */
private static final long serialVersionUID = 2221831081869571296L; private static final long serialVersionUID = 2221831081869571296L;
protected Set<PropertyDefinition> properties;
protected RelationTypeDefinitionImpl() { protected RelationTypeDefinitionImpl() {
super(); super();
} }
public static RelationTypeDefinition<?,?> getRelationTypeDefinitionInstance(
Class<? extends BaseRelation<?,?>> clz) {
if(IsRelatedTo.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked")
Class<? extends IsRelatedTo<? extends Resource,? extends Resource>> c = (Class<? extends IsRelatedTo<? extends Resource,? extends Resource>>) clz;
return new IsRelatedToTypeDefinitionImpl(c);
} else if(ConsistsOf.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked")
Class<? extends ConsistsOf<? extends Resource,? extends Facet>> c = (Class<? extends ConsistsOf<? extends Resource,? extends Facet>>) clz;
return new ConsistsOfTypeDefinitionImpl(c);
}
return new RelationTypeDefinitionImpl<EntityTypeDefinition,EntityTypeDefinition>(clz);
}
public RelationTypeDefinitionImpl(Class<? extends BaseRelation<?,?>> clz) { public RelationTypeDefinitionImpl(Class<? extends BaseRelation<?,?>> clz) {
super(clz); super(clz);
if(IsRelatedTo.class.isAssignableFrom(clz)){ if(RelationTypeDefinition.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked") @SuppressWarnings({"unchecked", "rawtypes"})
Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>> c = (Class<? extends IsRelatedTo<? extends Resource, ? extends Resource>>) clz;
this.superClasses = retrieveSuperClasses(c, IsRelatedTo.class, Relation.NAME);
} else if(ConsistsOf.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked")
Class<? extends ConsistsOf<? extends Resource, ? extends Facet>> c = (Class<? extends ConsistsOf<? extends Resource, ? extends Facet>>) clz;
this.superClasses = retrieveSuperClasses(c, ConsistsOf.class, Relation.NAME);
} else if(RelationTypeDefinition.class.isAssignableFrom(clz)){
@SuppressWarnings("unchecked")
Class<RelationTypeDefinition> c = (Class<RelationTypeDefinition>) clz; Class<RelationTypeDefinition> c = (Class<RelationTypeDefinition>) clz;
this.superClasses = retrieveSuperClasses(c, RelationTypeDefinition.class, BaseRelation.NAME); this.superClasses = retrieveSuperClasses(c, RelationTypeDefinition.class, BaseRelation.NAME);
} else if(IsParentOf.class.isAssignableFrom(clz)) { } else if(IsParentOf.class.isAssignableFrom(clz)) {
@ -59,8 +61,6 @@ public final class RelationTypeDefinitionImpl extends TypeDefinitionImpl impleme
throw new RuntimeException("Type Hierachy Error"); throw new RuntimeException("Type Hierachy Error");
} }
this.properties = retrieveListOfProperties(clz);
discoverSourceAndTarget(clz); discoverSourceAndTarget(clz);
} }
@ -94,45 +94,37 @@ public final class RelationTypeDefinitionImpl extends TypeDefinitionImpl impleme
targetClass = (Class<? extends BaseEntity>) getGenericClass(typeParameters[1]); targetClass = (Class<? extends BaseEntity>) getGenericClass(typeParameters[1]);
} }
this.source = new EntityTypeDefinitionImpl(sourceClass); this.source = (S) new EntityTypeDefinitionImpl(sourceClass);
this.target = new EntityTypeDefinitionImpl(targetClass); this.target = (T) new EntityTypeDefinitionImpl(targetClass);
}
@Override
public Set<PropertyDefinition> getProperties() {
return properties;
} }
/* /*
* Java does not support class multiple inheritance. * Java does not support class multiple inheritance.
* TypeDefinitionImpl is the superclass so that this class does not inherits the methods and field of BaseRelationImpl * TypeDefinitionImpl is the superclass so that this class does not inherits the methods and field of BaseRelationImpl
* We need to copy them. * We need to copy them.
*/ */
protected EntityTypeDefinition source; protected S source;
protected EntityTypeDefinition target; protected T target;
@Override @Override
public EntityTypeDefinition getSource() { public S getSource() {
return source; return source;
} }
@Override @Override
public void setSource(EntityTypeDefinition source) { public void setSource(S source) {
this.source = source; this.source = source;
} }
@Override @Override
public EntityTypeDefinition getTarget() { public T getTarget() {
return target; return target;
} }
@Override @Override
public void setTarget(EntityTypeDefinition target) { public void setTarget(T target) {
this.target = target; this.target = target;
} }

View File

@ -1,17 +0,0 @@
package org.gcube.informationsystem.types.reference;
import java.util.Set;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
/**
* @author Luca Frosini (ISTI - CNR)
* This is just an useful interface to capture all type definition having properties
* such as FacetTypeDefinition, PropertyTypeDefinition, RelationTypeDefinition
*/
public interface PropertyCapableTypeDefinition {
public static final String PROPERTIES_PROPERTY = "properties";
public Set<PropertyDefinition> getProperties();
}

View File

@ -5,6 +5,7 @@ import java.util.Set;
import org.gcube.informationsystem.base.reference.ER; import org.gcube.informationsystem.base.reference.ER;
import org.gcube.informationsystem.types.annotations.Abstract; import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@ -19,6 +20,7 @@ public interface TypeDefinition extends ER {
public static final String DESCRIPTION_PROPERTY = "description"; public static final String DESCRIPTION_PROPERTY = "description";
public static final String ABSTRACT_PROPERTY = "abstract"; public static final String ABSTRACT_PROPERTY = "abstract";
public static final String TYPE_SUPERCLASSES_PROPERTY = "superClasses"; public static final String TYPE_SUPERCLASSES_PROPERTY = "superClasses";
public static final String PROPERTIES_PROPERTY = "properties";
@ISProperty(name = NAME_PROPERTY, readonly = true, mandatory = true, nullable = false) @ISProperty(name = NAME_PROPERTY, readonly = true, mandatory = true, nullable = false)
public String getName(); public String getName();
@ -32,4 +34,7 @@ public interface TypeDefinition extends ER {
@ISProperty(name = TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false) @ISProperty(name = TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false)
public Set<String> getSuperClasses(); public Set<String> getSuperClasses();
@ISProperty(name = PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
public Set<PropertyDefinition> getProperties();
} }

View File

@ -6,12 +6,13 @@ import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = EntityTypeDefinitionImpl.class) // Do not uncomment to manage subclasses @JsonDeserialize(as = EntityTypeDefinitionImpl.class)
public interface EntityTypeDefinition extends TypeDefinition, BaseEntity { public interface EntityTypeDefinition extends TypeDefinition, BaseEntity {
public static final String NAME = "EntityTypeDefinition"; //EntityTypeDefinition.class.getSimpleName(); public static final String NAME = "EntityTypeDefinition"; //EntityTypeDefinition.class.getSimpleName();
@ -34,6 +35,9 @@ public interface EntityTypeDefinition extends TypeDefinition, BaseEntity {
@ISProperty(name = TypeDefinition.TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false) @ISProperty(name = TypeDefinition.TYPE_SUPERCLASSES_PROPERTY, readonly = true, mandatory = true, nullable = false)
public Set<String> getSuperClasses(); public Set<String> getSuperClasses();
@Override
@ISProperty(name = TypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
public Set<PropertyDefinition> getProperties();
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */

View File

@ -1,25 +1,15 @@
package org.gcube.informationsystem.types.reference.entities; package org.gcube.informationsystem.types.reference.entities;
import java.util.Set;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.entities.FacetTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.entities.FacetTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.PropertyCapableTypeDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = FacetTypeDefinitionImpl.class) @JsonDeserialize(as = FacetTypeDefinitionImpl.class)
public interface FacetTypeDefinition extends EntityTypeDefinition, BaseEntity, PropertyCapableTypeDefinition { public interface FacetTypeDefinition extends EntityTypeDefinition, BaseEntity {
public static final String NAME = "FacetTypeDefinition"; //FacetTypeDefinition.class.getSimpleName(); public static final String NAME = "FacetTypeDefinition"; //FacetTypeDefinition.class.getSimpleName();
@Override
@ISProperty(name = PropertyCapableTypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
public Set<PropertyDefinition> getProperties();
} }

View File

@ -7,7 +7,6 @@ import org.gcube.informationsystem.base.reference.properties.BaseProperty;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.PropertyCapableTypeDefinition;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@ -15,7 +14,7 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = PropertyTypeDefinitionImpl.class) @JsonDeserialize(as = PropertyTypeDefinitionImpl.class)
public interface PropertyTypeDefinition<P extends BaseProperty> extends TypeDefinition, BaseProperty, PropertyCapableTypeDefinition { public interface PropertyTypeDefinition<P extends BaseProperty> extends TypeDefinition, BaseProperty {
public static final String NAME = "PropertyTypeDefinition"; // PropertyTypeDefinition.class.getSimpleName(); public static final String NAME = "PropertyTypeDefinition"; // PropertyTypeDefinition.class.getSimpleName();
@ -43,7 +42,7 @@ public interface PropertyTypeDefinition<P extends BaseProperty> extends TypeDefi
public Set<String> getSuperClasses(); public Set<String> getSuperClasses();
@Override @Override
@ISProperty(name = PropertyCapableTypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false) @ISProperty(name = TypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
public Set<PropertyDefinition> getProperties(); public Set<PropertyDefinition> getProperties();
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */

View File

@ -0,0 +1,17 @@
package org.gcube.informationsystem.types.reference.relations;
import org.gcube.informationsystem.types.impl.relations.ConsistsOfTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@JsonDeserialize(as = ConsistsOfTypeDefinitionImpl.class)
public interface ConsistsOfTypeDefinition extends RelationTypeDefinition<ResourceTypeDefinition, FacetTypeDefinition> {
public static final String NAME = "ConsistsOfTypeDefinition"; // ConsistsOfTypeDefinition.class.getSimpleName();
}

View File

@ -0,0 +1,16 @@
package org.gcube.informationsystem.types.reference.relations;
import org.gcube.informationsystem.types.impl.relations.IsRelatedToTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@JsonDeserialize(as = IsRelatedToTypeDefinitionImpl.class)
public interface IsRelatedToTypeDefinition extends RelationTypeDefinition<ResourceTypeDefinition, ResourceTypeDefinition> {
public static final String NAME = "IsRelatedToTypeDefinition"; // IsRelatedToTypeDefinition.class.getSimpleName();
}

View File

@ -5,7 +5,6 @@ import java.util.Set;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.BaseRelation;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl;
import org.gcube.informationsystem.types.reference.PropertyCapableTypeDefinition;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
@ -15,9 +14,10 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonDeserialize(as = RelationTypeDefinitionImpl.class) @JsonDeserialize(as = RelationTypeDefinitionImpl.class)
public interface RelationTypeDefinition extends TypeDefinition, BaseRelation<EntityTypeDefinition,EntityTypeDefinition>, PropertyCapableTypeDefinition { public interface RelationTypeDefinition<S extends EntityTypeDefinition, T extends EntityTypeDefinition>
extends TypeDefinition, BaseRelation<S,T> {
public static final String NAME = "RelationTypeDefinition"; // PropertyTypeDefiniton.class.getSimpleName(); public static final String NAME = "RelationTypeDefinition"; // RelationTypeDefinition.class.getSimpleName();
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
@ -38,14 +38,14 @@ public interface RelationTypeDefinition extends TypeDefinition, BaseRelation<Ent
public Set<String> getSuperClasses(); public Set<String> getSuperClasses();
@Override @Override
@ISProperty(name = PropertyCapableTypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false) @ISProperty(name = TypeDefinition.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
public Set<PropertyDefinition> getProperties(); public Set<PropertyDefinition> getProperties();
@Override @Override
public EntityTypeDefinition getSource(); public S getSource();
@Override @Override
public EntityTypeDefinition getTarget(); public T getTarget();
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */ /* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
/*@JsonGetter(value=SOURCE_PROPERTY) /*@JsonGetter(value=SOURCE_PROPERTY)

View File

@ -18,8 +18,6 @@ import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.BaseProperty;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.BaseRelation;
import org.gcube.informationsystem.types.annotations.ISProperty; import org.gcube.informationsystem.types.annotations.ISProperty;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -155,9 +153,11 @@ public class ISMDiscovery<ISM extends ISManageable> {
for(Class<? extends BaseEntity> entity : entityDiscovery.getDiscovered()) { for(Class<? extends BaseEntity> entity : entityDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", entity); logger.trace("Going to manage : {}", entity);
schemaAction.manageEntityClass(entity); schemaAction.manageEntityClass(entity);
/*
if(entity.getName().compareTo(BaseEntity.class.getName())==0 ) { if(entity.getName().compareTo(BaseEntity.class.getName())==0 ) {
schemaAction.manageEntityClass(EntityTypeDefinition.class); schemaAction.manageEntityClass(EntityTypeDefinition.class);
} }
*/
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ -170,9 +170,11 @@ public class ISMDiscovery<ISM extends ISManageable> {
Class<? extends BaseRelation> relation : relationDiscovery.getDiscovered()) { Class<? extends BaseRelation> relation : relationDiscovery.getDiscovered()) {
logger.trace("Going to manage : {}", relation); logger.trace("Going to manage : {}", relation);
schemaAction.manageRelationClass(relation); schemaAction.manageRelationClass(relation);
/*
if(relation.getName().compareTo(BaseRelation.class.getName())==0 ) { if(relation.getName().compareTo(BaseRelation.class.getName())==0 ) {
schemaAction.manageRelationClass(RelationTypeDefinition.class); schemaAction.manageRelationClass(RelationTypeDefinition.class);
} }
*/
} }
} }

View File

@ -1,13 +1,24 @@
package org.gcube.informationsystem.types; package org.gcube.informationsystem.types;
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.context.reference.relations.IsParentOf; import org.gcube.informationsystem.context.reference.relations.IsParentOf;
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl; import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo; import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; import org.gcube.informationsystem.model.reference.relations.Relation;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
import org.junit.Test; import org.junit.Test;
@ -25,23 +36,67 @@ public class SerializationTest {
TypeBinder.serializeType(EntityTest.class); TypeBinder.serializeType(EntityTest.class);
} }
@Test @Test
public void getISParentOfSchema() throws Exception{ public void makeTypeDefinition() throws Exception{
RelationTypeDefinition relationTypeDefinition = (RelationTypeDefinition) TypeBinder.createTypeDefinition(IsRelatedTo.class); EntityTypeDefinition resourceTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(ResourceTypeDefinition.class);
logger.info(ISMapper.marshal(relationTypeDefinition)); logger.info(ISMapper.marshal(resourceTypeDefinitionSelf));
RelationTypeDefinition rtd = (RelationTypeDefinition) TypeBinder.createTypeDefinition(IsParentOf.class);
logger.info(ISMapper.marshal(rtd));
RelationTypeDefinition rtdSelf = (RelationTypeDefinition) TypeBinder.createTypeDefinition(RelationTypeDefinition.class);
logger.info(ISMapper.marshal(rtdSelf));
@SuppressWarnings("rawtypes")
PropertyTypeDefinition ptd = (PropertyTypeDefinition) TypeBinder.createTypeDefinition(PropertyTypeDefinition.class);
logger.info(ISMapper.marshal(ptd));
} }
@Test
public void testEntityTypeDefinition() throws Exception{
EntityTypeDefinition baseEntityTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(BaseEntity.class);
logger.info(ISMapper.marshal(baseEntityTypeDefinition));
EntityTypeDefinition entityTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(Entity.class);
logger.info(ISMapper.marshal(entityTypeDefinition));
ResourceTypeDefinition resourceTypeDefinition = (ResourceTypeDefinition) TypeBinder.createTypeDefinition(Resource.class);
logger.info(ISMapper.marshal(resourceTypeDefinition));
FacetTypeDefinition facetTypeDefinition = (FacetTypeDefinition) TypeBinder.createTypeDefinition(Facet.class);
logger.info(ISMapper.marshal(facetTypeDefinition));
EntityTypeDefinition contextTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(Context.class);
logger.info(ISMapper.marshal(contextTypeDefinition));
EntityTypeDefinition entityTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(EntityTypeDefinition.class);
logger.info(ISMapper.marshal(entityTypeDefinitionSelf));
EntityTypeDefinition resourceTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(ResourceTypeDefinition.class);
logger.info(ISMapper.marshal(resourceTypeDefinitionSelf));
EntityTypeDefinition facetTypeDefinitionSelf = (EntityTypeDefinition) TypeBinder.createTypeDefinition(FacetTypeDefinition.class);
logger.info(ISMapper.marshal(facetTypeDefinitionSelf));
}
@Test
public void testRelationTypeDefinition() throws Exception{
@SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> relationTypeDefinition = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(Relation.class);
logger.info(ISMapper.marshal(relationTypeDefinition));
IsRelatedToTypeDefinition isRelatedToTypeDefinition = (IsRelatedToTypeDefinition) TypeBinder.createTypeDefinition(IsRelatedTo.class);
logger.info(ISMapper.marshal(isRelatedToTypeDefinition));
ConsistsOfTypeDefinition consistsOfTypeDefinition = (ConsistsOfTypeDefinition) TypeBinder.createTypeDefinition(ConsistsOf.class);
logger.info(ISMapper.marshal(consistsOfTypeDefinition));
@SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> isParentOfTypeDefinition = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(IsParentOf.class);
logger.info(ISMapper.marshal(isParentOfTypeDefinition));
@SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> rtdSelf = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(RelationTypeDefinition.class);
logger.info(ISMapper.marshal(rtdSelf));
@SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> isRelatedToTypeDefinitionSelf = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(IsRelatedToTypeDefinition.class);
logger.info(ISMapper.marshal(isRelatedToTypeDefinitionSelf));
@SuppressWarnings("unchecked")
RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition> consistsOfTypeDefinitionSelf = (RelationTypeDefinition<EntityTypeDefinition,EntityTypeDefinition>) TypeBinder.createTypeDefinition(ConsistsOfTypeDefinition.class);
logger.info(ISMapper.marshal(consistsOfTypeDefinitionSelf));
}
@Test @Test
public void testGetEnumcostants(){ public void testGetEnumcostants(){
@ -60,18 +115,14 @@ public class SerializationTest {
propagationConstraint.setAddConstraint(AddConstraint.propagate); propagationConstraint.setAddConstraint(AddConstraint.propagate);
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascadeWhenOrphan); propagationConstraint.setRemoveConstraint(RemoveConstraint.cascadeWhenOrphan);
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
String pg = mapper.writeValueAsString(propagationConstraint); String pg = mapper.writeValueAsString(propagationConstraint);
PropagationConstraint pgUnm = mapper.readValue(pg, PropagationConstraint.class); PropagationConstraint pgUnm = mapper.readValue(pg, PropagationConstraint.class);
logger.debug("{}", pgUnm); logger.debug("{}", pgUnm);
} }
@Test @Test
public void testTypeSerialization() throws Exception { public void testTypeSerialization() throws Exception {
String serialized = TypeBinder.serializeType(Header.class); String serialized = TypeBinder.serializeType(Header.class);