package org.gcube.informationsystem.types.impl.properties; import java.util.Set; import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore; import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName; import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.types.impl.TypeImpl; import org.gcube.informationsystem.types.reference.properties.Changelog; import org.gcube.informationsystem.types.reference.properties.LinkedEntity; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyType; /** * @author Luca Frosini (ISTI - CNR) */ @JsonTypeName(value = PropertyType.NAME) public final class PropertyTypeImpl

extends TypeImpl implements PropertyType

{ /** * Generated Serial Version UID */ private static final long serialVersionUID = 7532701373450638829L; protected Set properties; protected PropertyTypeImpl() { super(); } public PropertyTypeImpl(Class

clz) { super(clz); this.superClasses = retrieveSuperClasses(clz, PropertyElement.class, clz == PropertyElement.class ? null : PropertyElement.NAME); this.properties = retrieveListOfProperties(clz); } @Override public Set getProperties() { return properties; } @Override @JsonIgnore public AccessType getAccessType() { if(name.compareTo(PropertyType.NAME)==0) { return AccessType.PROPERTY_TYPE; } if(name.compareTo(PropertyDefinition.NAME)==0) { return AccessType.PROPERTY_DEFINITION; } if(name.compareTo(PropertyElement.NAME)==0 || name.compareTo(LinkedEntity.NAME)==0 || name.compareTo(Changelog.NAME)==0) { return AccessType.PROPERTY_ELEMENT; } return AccessType.PROPERTY; } }