Class AbstractModelService

    • Constructor Detail

      • AbstractModelService

        public AbstractModelService()
    • Method Detail

      • toModelLayer

        public <T> T toModelLayer​(java.lang.Object persistentValue)
        Description copied from interface: ModelService
        Converts arbitrary values into a representation to be used inside the model layer. Generally this converts all object with existing model converter into their model representation. Collections and maps are copied on demand. Any other objects stay unchanged.
        Specified by:
        toModelLayer in interface ModelService
        Parameters:
        persistentValue - the value loaded from persistence layer.
      • getModelForPersistentValue

        protected abstract java.lang.Object getModelForPersistentValue​(java.lang.Object persistentValue)
      • toPersistenceLayer

        public <T> T toPersistenceLayer​(java.lang.Object modelValue)
        Description copied from interface: ModelService
        Converts arbitrary model layer values into a form which may be used in persistence layer. Generally this converts all models back into their source. Collections and maps are copied on demand. Any other objects stay unchanged.
        Specified by:
        toPersistenceLayer in interface ModelService
        Parameters:
        modelValue - the value to be translated back into persistence layer form
      • getPersistentValueForModel

        protected abstract java.lang.Object getPersistentValueForModel​(java.lang.Object model)
      • getAllSources

        public <T extends java.util.Collection> T getAllSources​(java.util.Collection<? extends java.lang.Object> models,
                                                                T result)
        Description copied from interface: ModelService
        Convenience method to load all the sources of a given collection of models
        Specified by:
        getAllSources in interface ModelService
        Parameters:
        models - the objects for which to retrieve model instances
        result - the collection to add the model instances to
        Returns:
        the result collects
      • getAll

        public <T extends java.util.Collection> T getAll​(java.util.Collection<? extends java.lang.Object> sources,
                                                         T result)
        Description copied from interface: ModelService
        Convenience method to load all objects in a source collection and adding the loaded objects to a result collection.
        Specified by:
        getAll in interface ModelService
        Parameters:
        sources - the objects for which to retrieve model instances
        result - the collection to add the model instances to
        Returns:
        the result collects
        See Also:
        ModelService.get(Object)
      • getAll

        public <T extends java.util.Collection> T getAll​(java.util.Collection<? extends java.lang.Object> sources,
                                                         T result,
                                                         java.lang.String conversionType)
        Description copied from interface: ModelService
        Convenience method to load all objects in a source collection and adding the loaded objects to a result collection. This method allows to specify the type to lookup the converter!
        Specified by:
        getAll in interface ModelService
        Parameters:
        sources - the objects for which to retrieve model instances
        result - the collection to add the model instances to
        conversionType - the type to be used for looking up the model converter
        Returns:
        the result collects
        See Also:
        ModelService.get(Object)