Class Entity

java.lang.Object
fr.olympus.prometheus.entity.Entity
All Implemented Interfaces:
IEntity

public abstract class Entity extends Object implements IEntity
Abstract base class for all entities in the system. Provides common properties and methods for managing entity metadata and state.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected UUID
    Current UUID of the entity instance.
    protected String[]
    Groups that this entity belongs to.
    protected boolean
    Indicates whether the entity is alive.
    protected final String
    Name of the entity.
    protected String
    Unique identifier for the entity in the registry.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Entity(String name)
    Constructs a new Entity with the specified name.
  • Method Summary

    Modifier and Type
    Method
    Description
    Sets the alive status of the entity.
    Gets the groups that this entity belongs to.
    Gets the name of the entity.
    Gets the unique identifier of the entity in the registry.
    boolean
    Checks if the entity belongs to a specific group.
    boolean
    hasGroups(String[] groups)
    Checks if the entity belongs to all of the specified groups.
    boolean
    Checks if the entity is alive.
    void
    setAlive(boolean alive)
    Sets the alive status of the entity.
    void
    setRegistryMeta(String registryId, String[] groups)
    Sets the registry metadata for the entity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface fr.olympus.prometheus.entity.IEntity

    kill
  • Field Details

    • registryId

      protected String registryId
      Unique identifier for the entity in the registry.
    • name

      protected final String name
      Name of the entity.
    • currentUUID

      protected UUID currentUUID
      Current UUID of the entity instance.
    • isAlive

      protected boolean isAlive
      Indicates whether the entity is alive.
    • groups

      protected String[] groups
      Groups that this entity belongs to.
  • Constructor Details

    • Entity

      protected Entity(String name)
      Constructs a new Entity with the specified name.
      Parameters:
      name - The name of the entity.
      Throws:
      IllegalArgumentException - if name is null or blank.
  • Method Details

    • getRegistryId

      public String getRegistryId()
      Gets the unique identifier of the entity in the registry.
      Specified by:
      getRegistryId in interface IEntity
      Returns:
      The registry ID of the entity.
    • setRegistryMeta

      public void setRegistryMeta(String registryId, String[] groups)
      Sets the registry metadata for the entity.
      Specified by:
      setRegistryMeta in interface IEntity
      Parameters:
      registryId - The unique identifier in the registry.
      groups - An array of strings representing the groups to which the entity belongs.
      Throws:
      IllegalArgumentException - if registryId is null or blank.
    • isAlive

      public boolean isAlive()
      Checks if the entity is alive.
      Specified by:
      isAlive in interface IEntity
      Returns:
      true if the entity is alive, false otherwise.
    • setAlive

      public void setAlive(boolean alive)
      Sets the alive status of the entity.
      Specified by:
      setAlive in interface IEntity
      Parameters:
      alive - A boolean value indicating whether the entity is alive (true) or dead (false).
    • currentUUID

      public UUID currentUUID()
      Sets the alive status of the entity.
      Specified by:
      currentUUID in interface IEntity
      Returns:
      true if the entity is now alive, false if it is now dead.
    • getName

      public String getName()
      Gets the name of the entity.
      Specified by:
      getName in interface IEntity
      Returns:
      The name of the entity.
    • entityGroup

      public String[] entityGroup()
      Gets the groups that this entity belongs to.
      Specified by:
      entityGroup in interface IEntity
      Returns:
      An array of group names that this entity belongs to.
    • hasGroup

      public boolean hasGroup(String group)
      Checks if the entity belongs to a specific group.
      Specified by:
      hasGroup in interface IEntity
      Parameters:
      group - The name of the group to check.
      Returns:
      true if the entity belongs to the specified group, false otherwise.
    • hasGroups

      public boolean hasGroups(String[] groups)
      Checks if the entity belongs to all of the specified groups.
      Specified by:
      hasGroups in interface IEntity
      Parameters:
      groups - An array of group names to check.
      Returns:
      true if the entity belongs to all of the specified groups, false otherwise.