Class EntityHydration


  • @Component
    public class EntityHydration
    extends Object
    Hydrates and dehydrates entities.
    • Constructor Detail

      • EntityHydration

        public EntityHydration​(EntityManager entityManager)
    • Method Detail

      • hydrate

        public Entity hydrate​(Map<String,​Object> dehydratedEntity,
                              EntityType entityType)
        Rehydrate an entity.
        Parameters:
        entityType - metadata of the entity to rehydrate
        dehydratedEntity - map with key value pairs representing this entity
        Returns:
        hydrated entity
      • hydrate

        public Entity hydrate​(Map<String,​Object> dehydratedEntity,
                              EntityType entityType,
                              @Nullable @CheckForNull
                              Fetch fetch)
        Rehydrate a partial entity.
        Parameters:
        entityType - metadata of the entity to rehydrate
        dehydratedEntity - map with key value pairs representing this entity
        fetch - containing attributes to retrieve, can be null
        Returns:
        hydrated entity
      • dehydrate

        public Map<String,​Object> dehydrate​(Entity entity)
        Creates a Map containing the values required to rebuild this entity. For references to other entities only stores the ids.
        Parameters:
        entity - the Entity to dehydrate
        Returns:
        Map representation of the entity