Class Mapping<TRootModel extends org.eclipse.emf.ecore.EObject,​TInput>

    • Constructor Detail

      • Mapping

        @Deprecated
        protected Mapping​(TInput input,
                          Class<TRootModel> rootClass)
        Deprecated.
        Constructor. Initialize require fields.
        Parameters:
        input - the root domain model
        rootClass - the root class
      • Mapping

        protected Mapping​(Supplier<TInput> inputSupplier,
                          Class<TRootModel> rootClass)
        Initializes a new instance.
        Parameters:
        inputSupplier - the root domain model supplier, can't be null
        rootClass - the root class, can't be null
    • Method Detail

      • getCompletedRoot

        public TRootModel getCompletedRoot()
        Gets completed root projection model or null in case if it has not been created yet.
        Returns:
        the root object of projection model, can be null
      • buildRootModel

        public void buildRootModel()
        Starts the projection model loading.
      • getRootClass

        public Class<TRootModel> getRootClass()
        Class of root projection model.
        Returns:
        the class of root projection model
      • setController

        public void setController​(MappingController controller)
        Sets a controller.
        Parameters:
        controller - the controller, can be null
      • handleEvent

        public abstract void handleEvent​(AbstractEvent event)
        The event processing. To the help of this method there is an evolution of a projection model.
        Parameters:
        event - the event for processing, can't be null
      • getRelatedModel

        public IMappingModel<? extends org.eclipse.emf.ecore.EObject> getRelatedModel​(Object domain)
        Get related projection model by domain model
        Parameters:
        domain - the domain model
        Returns:
        the projection model
        See Also:
        CommonQuery#first()
      • get

        public <TResult> TResult get​(IQuery<TResult,​TRootModel> query)
        The method allows to take data from projective model on means query object(IQuery).
        Parameters:
        query - the query object.
        Returns:
        the result.
      • fullUpdate

        public void fullUpdate()
        This method full update all mapping model asynchronously.
      • isDisposed

        public boolean isDisposed()
        Gets a value indicating that the current mapping has been already disposed.
        Returns:
        true if has been already disposed, otherwise - false
      • dispose

        public void dispose()
        Disposes the current mapping and detach controller of it.
      • getRootModel

        protected TRootModel getRootModel()
        Gets or creates root projection model synchronously.

        Use getCompletedRoot() to avoid the root creation.

        Returns:
        the root object of projection model, can be null
      • addRelation

        protected void addRelation​(Object from,
                                   IMappingModel<? extends org.eclipse.emf.ecore.EObject> to)
        Creates a relation between projection model and domain model.
        Parameters:
        from - the domain model, can't be null
        to - the relation model, can't be null
      • removeRelation

        protected void removeRelation​(Object from)
        Removes all relation between projection model and domain model.
        Parameters:
        from - the domain model, can't be null
      • removeRelation

        protected void removeRelation​(Object from,
                                      IMappingModel<? extends org.eclipse.emf.ecore.EObject> mapping)
        Removes a relation between projection model and domain model.
        Parameters:
        from - the domain model, can't be null
        mapping - the mapping model, can't be null
      • clearAllRelation

        protected void clearAllRelation()
        This method removes all relation between mapping models and domain models.
      • pushEvent

        protected void pushEvent​(AbstractEvent event)
        Fire all mapping model listeners through the current mapping contoller.
        Parameters:
        event - the mapping model event, can't be null
      • createComparer

        protected DtObjectMap.IComparer<Object> createComparer()
        Creates a comparer for DtObjectMap of relation between domain model and projection.
        Returns:
        the new comparer, never null
      • createRoot

        protected abstract TRootModel createRoot()
        The method creates a new root projection model.
        Returns:
        the root model of mapping, never null
      • fillModel

        protected abstract void fillModel​(TRootModel model,
                                          TInput input)
        Methods fill projection model.
        Parameters:
        model - the root projection model for filling, can't be null
        input - the root domain model, can't be null
      • clearRoot

        protected abstract void clearRoot​(TRootModel model)
        The method clear root mapping model.
        Parameters:
        model - the root mapping model, can't be null