Class TypeImpl

    • Field Detail

      • DEFAULT_CHANGELOG_MAP

        public static final Map<Version,​String> DEFAULT_CHANGELOG_MAP
        The default changelog map.
      • uuid

        protected UUID uuid
        The UUID of the type.
      • metadata

        protected Metadata metadata
        The metadata of the type.
      • name

        protected String name
        The name of the type.
      • description

        protected String description
        The description of the type.
      • version

        protected Version version
        The version of the type.
      • changelog

        protected Map<Version,​String> changelog
        The changelog of the type.
      • abstractType

        protected boolean abstractType
        Whether the type is abstract.
      • finalClass

        protected boolean finalClass
        Whether the type is final.
      • extendedTypes

        protected Set<String> extendedTypes
        The extended types.
    • Constructor Detail

      • TypeImpl

        protected TypeImpl()
        Default constructor.
      • TypeImpl

        protected TypeImpl​(Class<? extends Element> clz)
        Constructs a new TypeImpl from a class.
        Parameters:
        clz - the class
    • Method Detail

      • retrieveSuperClasses

        protected <E extends ElementSet<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 type
        baseClass - the base class
        topSuperClass - the top super class
        Returns:
        the set of super classes
      • retrieveListOfProperties

        protected Set<PropertyDefinition> retrieveListOfProperties​(Class<?> clz)
        Retrieves the list of properties of a class.
        Parameters:
        clz - the class
        Returns:
        the set of properties
      • getGenericClass

        protected Class<?> getGenericClass​(Type type)
        Gets the generic class of a type.
        Parameters:
        type - the type
        Returns:
        the generic class
      • getInstance

        public static Type getInstance​(Class<? extends Element> clz)
        Gets an instance of a type.
        Parameters:
        clz - the class
        Returns:
        the type instance
      • getID

        public UUID getID()
        Returns the unique identifier (UUID) of the element.
        Specified by:
        getID in interface IdentifiableElement
        Specified by:
        getID in interface Type
        Returns:
        The UUID of the element.
      • setID

        public void setID​(UUID uuid)
        Sets the unique identifier (UUID) for the element.
        Specified by:
        setID in interface IdentifiableElement
        Specified by:
        setID in interface Type
        Parameters:
        uuid - The UUID to set.
      • getMetadata

        public Metadata getMetadata()
        Returns the metadata associated with the element.

        The metadata is included in JSON serialization only if it is not null.

        Specified by:
        getMetadata in interface IdentifiableElement
        Specified by:
        getMetadata in interface Type
        Returns:
        The Metadata of the element, or null if none is set.
      • getName

        public String getName()
        Returns the name of the type.
        Specified by:
        getName in interface Type
        Returns:
        The type name.
      • getDescription

        public String getDescription()
        Returns the description of the type.
        Specified by:
        getDescription in interface Type
        Returns:
        The type description.
      • getVersion

        public Version getVersion()
        Returns the version of the type.
        Specified by:
        getVersion in interface Type
        Returns:
        The type version.
      • getVersionAsString

        public String getVersionAsString()
        Gets the version as a string.
        Specified by:
        getVersionAsString in interface Type
        Returns:
        the version as a string
      • setVersion

        public void setVersion​(String version)
        Sets the version from a string.
        Parameters:
        version - the version as a string
      • getChangelog

        public Map<Version,​String> getChangelog()
        Returns the changelog for this type.
        Specified by:
        getChangelog in interface Type
        Returns:
        A map of versions to change descriptions.
      • getChangelogWithVersionAsString

        public Map<String,​String> getChangelogWithVersionAsString()
        Gets the changelog with the version as a string.
        Specified by:
        getChangelogWithVersionAsString in interface Type
        Returns:
        the changelog with the version as a string
      • setChangelog

        public void setChangelog​(Map<String,​String> changelog)
        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:
        isAbstract in interface Type
        Returns:
        true if the type is abstract, false otherwise.
      • isFinal

        public boolean isFinal()
        Checks if the type is final.
        Specified by:
        isFinal in interface Type
        Returns:
        true if the type is final, false otherwise.
      • getExtendedTypes

        public Set<String> getExtendedTypes()
        Returns the set of types that this type extends.
        Specified by:
        getExtendedTypes in interface Type
        Returns:
        A set of parent type names.
      • getTypeName

        public String getTypeName()
        Returns the name of the element's type. This is typically used for type identification in serialized forms.
        Specified by:
        getTypeName in interface Element
        Returns:
        The type name of the element.