All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.entity.Entity.kt Maven / Gradle / Ivy

There is a newer version: 0.15.0
Show newest version
package dev.kord.core.entity

import dev.kord.common.entity.Snowflake
import dev.kord.core.KordObject

public interface Entity : Comparable {
    /**
     * The unique identifier of this entity.
     */
    public val id: Snowflake

    /**
     * Compares entities on [id].
     */
    override operator fun compareTo(other: Entity): Int = comparator.compare(this, other)

    public companion object {
        public val comparator: Comparator = compareBy(Entity::id)
    }
}

/**
 * An object that is identified by its [id].
 * This object holds a [KordObject]
 */
public interface KordEntity : KordObject, Entity




© 2015 - 2024 Weber Informatics LLC | Privacy Policy