Class MutableEntityExtendedImp

java.lang.Object
net.tangly.core.MutableEntityExtendedImp
All Implemented Interfaces:
Entity, EntityExtended, HasComments, HasDateRange, HasId, HasMutableComments, HasMutableDateRange, HasMutableId, HasMutableName, HasMutableTags, HasMutableText, HasName, HasOid, HasTags, HasText, MutableEntity, MutableEntityExtended

public abstract class MutableEntityExtendedImp extends Object implements HasDateRange, MutableEntityExtended
Default implementation of the MutableEntityExtended interface. The unique object identifier shall be set at construction.
  • Constructor Details

    • MutableEntityExtendedImp

      protected MutableEntityExtendedImp(long oid)
  • Method Details

    • init

      public static <T extends MutableEntityExtended> T init(T entity, String id, String name, LocalDate from, LocalDate to, String text)
    • oid

      public long oid()
      Description copied from interface: HasOid
      Return the unique internal identifier of the instance.
      Specified by:
      oid in interface HasOid
      Returns:
      unique internal identifier
    • id

      public String id()
      Description copied from interface: HasId
      Return the unique external identifier of the instance.
      Specified by:
      id in interface HasId
      Returns:
      unique external identifier
    • id

      public void id(String id)
      Description copied from interface: HasMutableId
      Set the identifier of the instance.
      Specified by:
      id in interface HasMutableId
      Parameters:
      id - new ID of the instance.
    • name

      public String name()
      Specified by:
      name in interface HasName
    • name

      public void name(String name)
      Specified by:
      name in interface HasMutableName
    • range

      public DateRange range()
      Description copied from interface: HasDateRange
      Return the range of the mixin.
      Specified by:
      range in interface HasDateRange
      Returns:
      date range of the mixin
    • range

      public void range(@NotNull @NotNull DateRange range)
      Specified by:
      range in interface HasMutableDateRange
    • text

      public String text()
      Description copied from interface: HasText
      Return the human-readable text description of the instance.
      Specified by:
      text in interface HasText
      Returns:
      human-readable text description of the instance
    • text

      public void text(String text)
      Description copied from interface: HasMutableText
      Set the text description of the entity.
      Specified by:
      text in interface HasMutableText
      Parameters:
      text - human readable text description
      See Also:
    • comments

      public Collection<Comment> comments()
      Description copied from interface: HasComments
      Return the collection of comments owned by the entity.
      Specified by:
      comments in interface HasComments
      Returns:
      list of comments
    • comments

      public void comments(Collection<Comment> comments)
      Description copied from interface: HasMutableComments
      Set the new collection of comments.
      Specified by:
      comments in interface HasMutableComments
      Parameters:
      comments - new collection of comments
      See Also:
    • add

      public void add(@NotNull @NotNull Comment comment)
      Description copied from interface: HasMutableComments
      Adds a comment to the list of comments.
      Specified by:
      add in interface HasMutableComments
      Parameters:
      comment - comment to be added, cannot be null
    • remove

      public void remove(@NotNull @NotNull Comment comment)
      Description copied from interface: HasMutableComments
      Remove the given comment from the list of comments.
      Specified by:
      remove in interface HasMutableComments
      Parameters:
      comment - comment to be removed, cannot be null
    • tags

      public Collection<Tag> tags()
      Description copied from interface: HasTags
      Returns the collection of tags for the entity.
      Specified by:
      tags in interface HasTags
      Returns:
      collection of tags
    • tags

      public void tags(@NotNull @NotNull Collection<Tag> tags)
      Description copied from interface: HasMutableTags
      Set the new collection of tags for the entity.
      Specified by:
      tags in interface HasMutableTags
      Parameters:
      tags - new collection of tags
      See Also:
    • add

      public boolean add(@NotNull @NotNull Tag tag)
      Description copied from interface: HasMutableTags
      Add the tag to the collection of tags.
      Specified by:
      add in interface HasMutableTags
      Parameters:
      tag - tag to be added
      Returns:
      true if this collection did not already contain the specified element
      See Also:
    • remove

      public boolean remove(@NotNull @NotNull Tag tag)
      Description copied from interface: HasMutableTags
      Remove the tag from the collection of tags.
      Specified by:
      remove in interface HasMutableTags
      Parameters:
      tag - tag to remove
      Returns:
      true if this collection contained the specified element
      See Also:
    • clear

      public void clear()
      Specified by:
      clear in interface HasMutableTags
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object