Fixed compiling error

This commit is contained in:
Luca Frosini 2020-01-29 16:33:51 +01:00
parent 7899526d65
commit 4bf95bc2ea
2 changed files with 42 additions and 2 deletions

View File

@ -48,8 +48,8 @@ public class RelationTypeDefinitionImpl<S extends EntityTypeDefinition, T extend
super(clz);
if(RelationTypeDefinition.class.isAssignableFrom(clz)) {
@SuppressWarnings({"unchecked", "rawtypes"})
Class<RelationTypeDefinition> c = (Class<RelationTypeDefinition>) clz;
@SuppressWarnings({"unchecked"})
Class<RelationTypeDefinition<?,?>> c = (Class<RelationTypeDefinition<?,?>>) clz;
this.superClasses = retrieveSuperClasses(c, RelationTypeDefinition.class, BaseRelation.NAME);
} else if(IsParentOf.class.isAssignableFrom(clz)) {
@SuppressWarnings("unchecked")

View File

@ -1,22 +1,28 @@
package org.gcube.informationsystem.types;
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.context.reference.relations.IsParentOf;
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.Encrypted;
import org.gcube.informationsystem.model.reference.properties.Header;
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.RemoveConstraint;
import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
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.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition;
import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
@ -42,6 +48,40 @@ public class SerializationTest {
logger.info(ISMapper.marshal(resourceTypeDefinitionSelf));
}
@Test
public void testPropertyTypeDefinition() throws Exception{
@SuppressWarnings("unchecked")
PropertyTypeDefinition<BaseProperty> basePropertyTypeDefinition = (PropertyTypeDefinition<BaseProperty>) TypeBinder.createTypeDefinition(BaseProperty.class);
logger.info(ISMapper.marshal(basePropertyTypeDefinition));
@SuppressWarnings("unchecked")
PropertyTypeDefinition<Property> propertyTypeDefinition = (PropertyTypeDefinition<Property>) TypeBinder.createTypeDefinition(Property.class);
logger.info(ISMapper.marshal(propertyTypeDefinition));
@SuppressWarnings("unchecked")
PropertyTypeDefinition<Header> headerTypeDefinition = (PropertyTypeDefinition<Header>) TypeBinder.createTypeDefinition(Header.class);
logger.info(ISMapper.marshal(headerTypeDefinition));
@SuppressWarnings("unchecked")
PropertyTypeDefinition<PropagationConstraint> propagationConstraintDefinition = (PropertyTypeDefinition<PropagationConstraint>) TypeBinder.createTypeDefinition(PropagationConstraint.class);
logger.info(ISMapper.marshal(propagationConstraintDefinition));
@SuppressWarnings("unchecked")
PropertyTypeDefinition<Encrypted> encryptedTypeDefinition = (PropertyTypeDefinition<Encrypted>) TypeBinder.createTypeDefinition(Encrypted.class);
logger.info(ISMapper.marshal(encryptedTypeDefinition));
@SuppressWarnings("unchecked")
PropertyTypeDefinition<PropertyDefinition> propertyDefinition = (PropertyTypeDefinition<PropertyDefinition>) TypeBinder.createTypeDefinition(PropertyDefinition.class);
logger.info(ISMapper.marshal(propertyDefinition));
@SuppressWarnings("unchecked")
PropertyTypeDefinition<ResourceEntryDefinition> resourceEntryDefinition = (PropertyTypeDefinition<ResourceEntryDefinition>) TypeBinder.createTypeDefinition(ResourceEntryDefinition.class);
logger.info(ISMapper.marshal(resourceEntryDefinition));
}
@Test
public void testEntityTypeDefinition() throws Exception{
EntityTypeDefinition baseEntityTypeDefinition = (EntityTypeDefinition) TypeBinder.createTypeDefinition(BaseEntity.class);