Class EntityIdPath

java.lang.Object
org.fuin.objects4j.vo.AbstractStringValueObject
org.fuin.ddd4j.ddd.EntityIdPath
All Implemented Interfaces:
Serializable, Comparable<org.fuin.objects4j.vo.AbstractStringValueObject>, org.fuin.objects4j.vo.AsStringCapable, org.fuin.objects4j.vo.ValueObject, org.fuin.objects4j.vo.ValueObjectWithBaseType<String>

public final class EntityIdPath extends org.fuin.objects4j.vo.AbstractStringValueObject implements Serializable
An ordered list of entity identifiers. An aggregate root will be the first entry if it's contained in the list.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Divides the entity identifiers in the path.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor with ID list.
    EntityIdPath(EntityId... entityIds)
    Constructor with ID array.
  • Method Summary

    Modifier and Type
    Method
    Description
    final String
     
    final <T extends EntityId>
    T
    Returns the first entity identifier in the path.
    Creates a NEW list of the entity identifiers contained in the entity id path and returns an iterator on it.
    final <T extends EntityId>
    T
    Returns the last entity identifier in the path.
    Returns the parent path without the last entry.
    Returns the path without the first entry.
    final int
    Returns the number of elements in the path.
    final String
     

    Methods inherited from class org.fuin.objects4j.vo.AbstractStringValueObject

    asString, compareTo, equals, getBaseType, hashCode, length

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • PATH_SEPARATOR

      public static final String PATH_SEPARATOR
      Divides the entity identifiers in the path.
      See Also:
  • Constructor Details

    • EntityIdPath

      public EntityIdPath(EntityId... entityIds)
      Constructor with ID array.
      Parameters:
      entityIds - Entity identifier in correct order (from outer to inner).
    • EntityIdPath

      public EntityIdPath(List<EntityId> ids)
      Constructor with ID list.
      Parameters:
      ids - Entity identifiers in correct order (from outer to inner).
  • Method Details

    • iterator

      public final Iterator<EntityId> iterator()
      Creates a NEW list of the entity identifiers contained in the entity id path and returns an iterator on it. This means deleting an element using the Iterator.remove() method will NOT remove something from this entity id path.
      Returns:
      Iterator on a new list instance.
    • first

      public final <T extends EntityId> T first()
      Returns the first entity identifier in the path.
      Type Parameters:
      T - Type of the entity identifier that is returned.
      Returns:
      First entity identifier in the path.
    • last

      public final <T extends EntityId> T last()
      Returns the last entity identifier in the path.
      Type Parameters:
      T - Type of the entity identifier that is returned.
      Returns:
      Last entity identifier in the path.
    • rest

      public final EntityIdPath rest()
      Returns the path without the first entry.
      Returns:
      Rest or NULL if the path has only one element.
    • parent

      public EntityIdPath parent()
      Returns the parent path without the last entry.
      Returns:
      Parent identifier path or NULL if this is an aggregate root ID.
    • size

      public final int size()
      Returns the number of elements in the path.
      Returns:
      Number of identifiers contained in the path.
    • asBaseType

      public final String asBaseType()
      Specified by:
      asBaseType in interface org.fuin.objects4j.vo.ValueObjectWithBaseType<String>
    • toString

      public final String toString()
      Overrides:
      toString in class Object