Class TypeImpl
java.lang.Object
org.gcube.informationsystem.types.impl.TypeImpl
- All Implemented Interfaces:
Serializable,Element,IdentifiableElement,Type
- Direct Known Subclasses:
EntityTypeImpl,PropertyTypeImpl,RelationTypeImpl
The default implementation of the
Type interface.- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether the type is abstract.The changelog of the type.The default changelog map.protected StringThe description of the type.The extended types.protected booleanWhether the type is final.protected MetadataThe metadata of the type.protected StringThe name of the type.protected Set<PropertyDefinition>The properties of the type.protected UUIDThe UUID of the type.protected VersionThe version of the type.Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, TYPE_PROPERTYFields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTYFields inherited from interface org.gcube.informationsystem.types.reference.Type
ABSTRACT_PROPERTY, CHANGELOG_PROPERTY, DESCRIPTION_PROPERTY, EXTENDED_TYPES_PROPERTY, FINAL_PROPERTY, NAME, NAME_PROPERTY, PROPERTIES_PROPERTY, VERSION_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns theAccessTypeof this type definition.Returns the changelog for this type.Gets the changelog with the version as a string.Returns the description of the type.Returns the set of types that this type extends.protected Class<?>getGenericClass(Type type) Gets the generic class of a type.getID()Returns the unique identifier (UUID) of the element.static TypegetInstance(Class<? extends Element> clz) Gets an instance of a type.Returns the metadata associated with the element.getName()Returns the name of the type.Gets the properties of the type.Returns the name of the element's type.Returns the version of the type.Gets the version as a string.booleanChecks if the type is abstract.booleanisFinal()Checks if the type is final.protected Set<PropertyDefinition>retrieveListOfProperties(Class<?> clz) Retrieves the list of properties of a class.retrieveSuperClasses(Class<? extends E> type, Class<E> baseClass, String topSuperClass) Retrieves the super classes of a type.voidsetChangelog(Map<String, String> changelog) Sets the changelog from a map with the version as a string.voidSets the unique identifier (UUID) for the element.voidsetMetadata(Metadata metadata) Sets the metadata for the element.voidsetVersion(String version) Sets the version from a string.
-
Field Details
-
DEFAULT_CHANGELOG_MAP
The default changelog map. -
uuid
The UUID of the type. -
metadata
The metadata of the type. -
name
The name of the type. -
description
The description of the type. -
version
The version of the type. -
changelog
The changelog of the type. -
abstractType
protected boolean abstractTypeWhether the type is abstract. -
finalClass
protected boolean finalClassWhether the type is final. -
extendedTypes
The extended types. -
properties
The properties of the type.
-
-
Constructor Details
-
TypeImpl
protected TypeImpl()Default constructor. -
TypeImpl
Constructs a new TypeImpl from a class.- Parameters:
clz- the class
-
-
Method Details
-
retrieveSuperClasses
protected <E extends Element> Set<String> retrieveSuperClasses(Class<? extends E> type, Class<E> baseClass, String topSuperClass) Retrieves the super classes of a type.- Type Parameters:
E- the element type- Parameters:
type- the typebaseClass- the base classtopSuperClass- the top super class- Returns:
- the set of super classes
-
retrieveListOfProperties
Retrieves the list of properties of a class.- Parameters:
clz- the class- Returns:
- the set of properties
-
getGenericClass
Gets the generic class of a type.- Parameters:
type- the type- Returns:
- the generic class
-
getInstance
Gets an instance of a type.- Parameters:
clz- the class- Returns:
- the type instance
-
getID
Returns the unique identifier (UUID) of the element.- Specified by:
getIDin interfaceIdentifiableElement- Specified by:
getIDin interfaceType- Returns:
- The
UUIDof the element.
-
setID
Sets the unique identifier (UUID) for the element.- Specified by:
setIDin interfaceIdentifiableElement- Specified by:
setIDin interfaceType- Parameters:
uuid- TheUUIDto set.
-
getMetadata
Returns the metadata associated with the element.The metadata is included in JSON serialization only if it is not null.
- Specified by:
getMetadatain interfaceIdentifiableElement- Specified by:
getMetadatain interfaceType- Returns:
- The
Metadataof the element, ornullif none is set.
-
setMetadata
Sets the metadata for the element.- Specified by:
setMetadatain interfaceIdentifiableElement- Specified by:
setMetadatain interfaceType- Parameters:
metadata- TheMetadatato associate with the element.
-
getName
Returns the name of the type. -
getDescription
Returns the description of the type.- Specified by:
getDescriptionin interfaceType- Returns:
- The type description.
-
getVersion
Returns the version of the type.- Specified by:
getVersionin interfaceType- Returns:
- The type version.
-
getVersionAsString
Gets the version as a string.- Specified by:
getVersionAsStringin interfaceType- Returns:
- the version as a string
-
setVersion
Sets the version from a string.- Parameters:
version- the version as a string
-
getChangelog
Returns the changelog for this type.- Specified by:
getChangelogin interfaceType- Returns:
- A map of versions to change descriptions.
-
getChangelogWithVersionAsString
Gets the changelog with the version as a string.- Specified by:
getChangelogWithVersionAsStringin interfaceType- Returns:
- the changelog with the version as a string
-
setChangelog
Sets the changelog from a map with the version as a string.- Parameters:
changelog- the changelog with the version as a string
-
isAbstract
public boolean isAbstract()Checks if the type is abstract.- Specified by:
isAbstractin interfaceType- Returns:
trueif the type is abstract,falseotherwise.
-
isFinal
public boolean isFinal()Checks if the type is final. -
getExtendedTypes
Returns the set of types that this type extends.- Specified by:
getExtendedTypesin interfaceType- Returns:
- A set of parent type names.
-
getProperties
Gets the properties of the type.- Specified by:
getPropertiesin interfaceType- Returns:
- the properties of the type
-
getAccessType
Returns theAccessTypeof this type definition.- Specified by:
getAccessTypein interfaceType- Returns:
- The access type.
-
getTypeName
Returns the name of the element's type. This is typically used for type identification in serialized forms.- Specified by:
getTypeNamein interfaceElement- Returns:
- The type name of the element.
-