Record Class ExtendedEntity<T,E extends Enum<E>>

java.lang.Object
java.lang.Record
fr.ght1pc9kc.entity.api.impl.ExtendedEntity<T,E>
All Implemented Interfaces:
Entity<T>

public record ExtendedEntity<T,E extends Enum<E>>(@NotNull String id, @NotNull EnumMap<E extends Enum<E>,Object> metas, T self) extends Record implements Entity<T>
  • Constructor Details

    • ExtendedEntity

      public ExtendedEntity(@NotNull @NotNull String id, @NotNull @NotNull EnumMap<E,Object> metas, @NotNull T self)
      Creates an instance of a ExtendedEntity record class.
      Parameters:
      id - the value for the id record component
      metas - the value for the metas record component
      self - the value for the self record component
  • Method Details

    • meta

      public <M> Optional<M> meta(Enum<?> property, Class<M> type)
      Specified by:
      meta in interface Entity<T>
    • convert

      public <S> Entity<S> convert(Function<T,S> converter)
      Specified by:
      convert in interface Entity<T>
    • withMeta

      public <S extends Enum<S>> Entity<T> withMeta(S key, Object value)
      Specified by:
      withMeta in interface Entity<T>
    • metas

      public EnumMap<E,Object> metas()
      Returns the value of the metas record component.
      Returns:
      the value of the metas record component
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      @NotNull public @NotNull String id()
      Returns the value of the id record component.
      Specified by:
      id in interface Entity<T>
      Returns:
      the value of the id record component
    • self

      @NotNull public T self()
      Returns the value of the self record component.
      Specified by:
      self in interface Entity<T>
      Returns:
      the value of the self record component