Class FieldHolder<T>

java.lang.Object
org.assertj.core.api.recursive.comparison.FieldHolder<T>
Type Parameters:
T - entity type
Direct Known Subclasses:
FieldComparators, FieldMessages

abstract class FieldHolder<T> extends Object
An abstract field holder which provides to pair a specific entities for fields described by their path without element index.
  • Field Details

    • fieldHolder

      protected final Map<String,T> fieldHolder
  • Constructor Details

    • FieldHolder

      public FieldHolder()
  • Method Details

    • put

      public void put(String fieldLocation, T entity)
      Pairs the giving entity with the fieldLocation.
      Parameters:
      fieldLocation - the field location where to apply the giving entity
      entity - the entity to pair
    • get

      public T get(String fieldLocation)
      Retrieves a specific entity which is associated with the giving filedLocation from the field holder, if it presents. Otherwise, this method returns null.
      Parameters:
      fieldLocation - the field location which has to be associated with an entity
      Returns:
      entity or null
    • hasEntity

      public boolean hasEntity(String fieldLocation)
      Checks, whether an any entity associated with the giving field location.
      Parameters:
      fieldLocation - the field location which association need to check
      Returns:
      is entity associated with field location
    • isEmpty

      public boolean isEmpty()
      Returns:
      true is there are registered entities, false otherwise
    • entryByField

      public Stream<Map.Entry<String,T>> entryByField()
      Returns a sequence of all field-entry pairs which the current holder supplies.
      Returns:
      sequence of field-entry pairs
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • formatRegisteredEntity

      private static <T> String formatRegisteredEntity(Map.Entry<String,T> entry)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object