Interface ModelContributable

    • Method Detail

      • getModel

        <T> T getModel​(String name)
        Returns the model object associated with the given name, or null if no model object of the given name exists.
        Parameters:
        name - the name of the model object
        Returns:
        the model object associated with the name, or null if the model object does not exist.
      • getModelNames

        Iterable<String> getModelNames()
        Returns an unmodifiable Iterable containing the names of the model objects available to this. This method returns an empty Iterable if this has no model object available to it.
        Returns:
        an Iterable of strings containing the names of model objects of this.
      • getModelsMap

        Map<String,​Object> getModelsMap()
        Returns an unmodifiable map of model objects contributed by setModel(String, Object).

        Note that the returned map contains only the pairs of model name and value objects contributed by setModel(String, Object), but it does not contain attributes set by #setAttribute(String,Object) API calls, whereas most implementations of this interface (such as HstRequest and HstRequestContext) provides a combined view for both models and other attributes through #getAttribute(String), #getAttributeNames() or #getAttributeMap.

        Returns:
        an unmodifiable map of model objects contributed by setModel(String, Object)
      • setModel

        Object setModel​(String name,
                        Object model)
        Stores a model object in this.

        Model objects are contributed by a controller component to this, in general. And, the contributed model objects may be accessed in view rendering or special model aggregation / serialization request pipeline processing.

        If the model object passed in is null, the effect is the same as calling removeModel(java.lang.String).

        Parameters:
        name - the name of the model object
        model - the model object to be stored
        Returns:
        the previous model object associated with name, or null if there was no mapping for name.
      • removeModel

        void removeModel​(String name)
        Removes a model object from this.
        Parameters:
        name - a String specifying the name of the model object to remove