Class ModelView

java.lang.Object
mg.emberframework.core.data.ModelView

public class ModelView extends Object
Represents a model and view for rendering responses in the framework.

This class encapsulates a URL, data attributes, and a redirect flag, typically used to pass data to a view or redirect to another URL.

Since:
1.0.0
Version:
1.0.0
Author:
Sandratra NIAINA
  • Constructor Details

    • ModelView

      public ModelView()
      Default constructor.
    • ModelView

      public ModelView(String url, Map<String,Object> data)
      Constructs a model view with a URL and data.
      Parameters:
      url - the target URL
      data - the data map
  • Method Details

    • addObject

      public void addObject(String attribute, Object object)
      Adds an object to the data map.
      Parameters:
      attribute - the attribute name
      object - the object to store
    • getUrl

      public String getUrl()
      Gets the target URL.
      Returns:
      the URL
    • setUrl

      public void setUrl(String url)
      Sets the target URL.
      Parameters:
      url - the URL to set
    • getData

      public Map<String,Object> getData()
      Gets the data map.
      Returns:
      the data map
    • setData

      public void setData(Map<String,Object> data)
      Sets the data map.
      Parameters:
      data - the data to set
    • isRedirect

      public boolean isRedirect()
      Checks if this is a redirect response.
      Returns:
      true if redirect, false otherwise
    • setRedirect

      public void setRedirect(boolean redirect)
      Sets the redirect flag.
      Parameters:
      redirect - the redirect status to set