Class ManagedEntityEnhancer


  • public class ManagedEntityEnhancer
    extends Object
    Entity Enhancer that creates proxy entities and adds functionalities like `refresh`, `update` based on the interfaces, the entity implements from.
    Author:
    Shashank Sharma
    • Constructor Detail

    • Method Detail

      • newEntity

        public <T extends Manageable> T newEntity​(Class<T> tClass)
        Creates a new entity of type `tClass`
        Type Parameters:
        T - type
        Parameters:
        tClass - the type of the object to be created
        Returns:
        an enhanced entity of type T
      • enhance

        public <T> T enhance​(T entity)
        Enhances an existing Manageable entity by providing a proxy implementation for all the manageable methods
        Type Parameters:
        T - type
        Parameters:
        entity - the entity to be enhanced
        Returns:
        an enhanced entity of type T
      • enhance

        public <T> T enhance​(T entity,
                             String collectionName)
        Enhances an existing Manageable entity by providing a proxy implementation for all the manageable methods
        Type Parameters:
        T - type
        Parameters:
        entity - entity to be enhanced
        collectionName - collection name
        Returns:
        an enhanced entity of type T
      • enhance

        public static <T> T enhance​(T entity,
                                    ManagedMongoTemplate mongoTemplate)
        Static implementation that enhances an existing Manageable entity by providing a proxy implementation for all the manageable methods
        Type Parameters:
        T - type
        Parameters:
        entity - entity to be enhanced
        mongoTemplate - Mongo template
        Returns:
        enhanced entity of type T
      • enhance

        public static <T> T enhance​(T entity,
                                    ManagedMongoTemplate mongoTemplate,
                                    String collectionName)
        Static implementation that enhances an existing Manageable entity by providing a proxy implementation for all the manageable methods
        Type Parameters:
        T - type
        Parameters:
        entity - entity to be enhanced
        mongoTemplate - Mongo template
        Returns:
        enhanced entity of type T