Class DefaultModelContext

  • All Implemented Interfaces:
    ModelContext

    public class DefaultModelContext
    extends java.lang.Object
    implements ModelContext
    Default model context implementation. Use spring scoped proxy mechanism to bind it to HybrisRequestScope. Any other scope could lead to memory problems since models are held forever (until scope dies)!
    • Constructor Detail

      • DefaultModelContext

        public DefaultModelContext()
    • Method Detail

      • modificationStatusChanged

        protected void modificationStatusChanged​(java.lang.Object model,
                                                 ModelConverter conv)
      • getStats

        public java.lang.String getStats()
      • attach

        public void attach​(java.lang.Object model,
                           java.lang.Object source,
                           ModelConverter conv)
        Description copied from interface: ModelContext
        Attaches a new model to the context.
        Specified by:
        attach in interface ModelContext
        Parameters:
        model - the model to hold
        source - the source element - may be null for new models
        conv - the converter used
      • convertKey

        @Deprecated(since="ages",
                    forRemoval=true)
        protected java.lang.Object convertKey​(java.lang.Object key)
        Deprecated, for removal: This API element is subject to removal in a future version.
        since ages
        Use unwrapKey(Object) instead

        deprecated @since 5.0

      • unwrapKey

        protected java.lang.Object unwrapKey​(java.lang.Object key)
      • detach

        public void detach​(java.lang.Object model,
                           java.lang.Object source,
                           ModelConverter conv)
        Description copied from interface: ModelContext
        Removes a model from context.
        Specified by:
        detach in interface ModelContext
        Parameters:
        model - the model to remove
        source - its source - may be null for new models
        conv - the converter which manages the model
      • getAttached

        public java.lang.Object getAttached​(java.lang.Object source,
                                            ModelConverter conv)
        Description copied from interface: ModelContext
        Returns a attached model for a given source element and converter.
        Specified by:
        getAttached in interface ModelContext
        Parameters:
        source - the source element - must not be null
        conv - the converter
      • clear

        public void clear()
        Description copied from interface: ModelContext
        Removes all attached models.
        Specified by:
        clear in interface ModelContext
      • getNew

        public java.util.Set<java.lang.Object> getNew()
        Description copied from interface: ModelContext
        Returns all attached model instances which are currently new.
        Specified by:
        getNew in interface ModelContext
      • getModified

        public java.util.Set<java.lang.Object> getModified()
        Description copied from interface: ModelContext
        Returns all attached model instances which are currently modified.
        Specified by:
        getModified in interface ModelContext