information-system-model/src/main/java/org/gcube/informationsystem/base/reference/Element.java

61 lines
2.2 KiB
Java
Raw Normal View History

/**
*
*/
package org.gcube.informationsystem.base.reference;
import java.io.Serializable;
2023-04-27 16:30:10 +02:00
import java.util.List;
2023-04-27 16:30:10 +02:00
import org.gcube.com.fasterxml.jackson.annotation.JsonGetter;
2023-04-27 10:59:20 +02:00
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
2023-04-27 16:30:10 +02:00
import org.gcube.com.fasterxml.jackson.annotation.JsonInclude;
import org.gcube.com.fasterxml.jackson.annotation.JsonInclude.Include;
import org.gcube.com.fasterxml.jackson.annotation.JsonPropertyOrder;
2020-07-07 17:04:25 +02:00
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.gcube.informationsystem.types.annotations.Abstract;
import org.gcube.informationsystem.types.reference.Change;
import org.gcube.informationsystem.types.reference.TypeMetadata;
2021-10-21 10:11:45 +02:00
import org.gcube.informationsystem.utils.Version;
/**
* @author Luca Frosini (ISTI - CNR)
*/
@Abstract
@JsonPropertyOrder({ Element.TYPE_PROPERTY, Element.SUPERTYPES_PROPERTY, Element.EXPECTED_TYPE_PROPERTY })
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = Element.TYPE_PROPERTY)
// @JsonTypeIdResolver(ElementTypeIdResolver.class)
2023-04-26 21:39:57 +02:00
@TypeMetadata(name = Element.NAME, description = "This is the base type for Element", version = Version.MINIMAL_VERSION_STRING)
2021-10-21 10:11:45 +02:00
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
public interface Element extends Serializable {
public static final String NAME = "Element"; //Element.class.getSimpleName();
public static final String TYPE_PROPERTY = "type";
public static final String SUPERTYPES_PROPERTY = "supertypes";
/*
* This is the key used by the deserializer to indicate the expected type
* which instead has been deserialized using the best available
* supertype
*/
public static final String EXPECTED_TYPE_PROPERTY = "expectedtype";
2020-02-04 09:44:10 +01:00
/**
* DateTime Pattern to be used to serialize Dates in every element
*/
public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss.SSS Z";
2023-04-27 10:59:20 +02:00
@JsonIgnore
public String getTypeName();
@JsonInclude(Include.NON_EMPTY)
2023-04-27 16:30:10 +02:00
@JsonGetter(value = SUPERTYPES_PROPERTY)
public List<String> getSupertypes();
@JsonInclude(Include.NON_EMPTY)
@JsonGetter(value = EXPECTED_TYPE_PROPERTY)
public String getExpectedtype();
}