Class FieldHolder<T>

  • Type Parameters:
    T - entity type
    Direct Known Subclasses:
    FieldComparators, FieldMessages

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

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.String,​T> fieldHolder  
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldHolder()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.stream.Stream<java.util.Map.Entry<java.lang.String,​T>> entryByField()
      Returns a sequence of all field-entry pairs which the current holder supplies.
      boolean equals​(java.lang.Object o)  
      private static <T> java.lang.String formatRegisteredEntity​(java.util.Map.Entry<java.lang.String,​T> entry)  
      T get​(java.lang.String fieldLocation)
      Retrieves a specific entity which is associated with the giving filedLocation from the field holder, if it presents.
      boolean hasEntity​(java.lang.String fieldLocation)
      Checks, whether an any entity associated with the giving field location.
      int hashCode()  
      boolean isEmpty()  
      void put​(java.lang.String fieldLocation, T entity)
      Pairs the giving entity with the fieldLocation.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • fieldHolder

        protected final java.util.Map<java.lang.String,​T> fieldHolder
    • Constructor Detail

      • FieldHolder

        public FieldHolder()
    • Method Detail

      • put

        public void put​(java.lang.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​(java.lang.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​(java.lang.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 java.util.stream.Stream<java.util.Map.Entry<java.lang.String,​T>> entryByField()
        Returns a sequence of all field-entry pairs which the current holder supplies.
        Returns:
        sequence of field-entry pairs
      • toString

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

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object