Package mg.emberframework.core.data
Class ModelView
java.lang.Object
mg.emberframework.core.data.ModelView
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an object to the data map.getData()
Gets the data map.getUrl()
Gets the target URL.boolean
Checks if this is a redirect response.void
Sets the data map.void
setRedirect
(boolean redirect) Sets the redirect flag.void
Sets the target URL.
-
Constructor Details
-
ModelView
public ModelView()Default constructor. -
ModelView
Constructs a model view with a URL and data.- Parameters:
url
- the target URLdata
- the data map
-
-
Method Details
-
addObject
Adds an object to the data map.- Parameters:
attribute
- the attribute nameobject
- the object to store
-
getUrl
Gets the target URL.- Returns:
- the URL
-
setUrl
Sets the target URL.- Parameters:
url
- the URL to set
-
getData
Gets the data map.- Returns:
- the data map
-
setData
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
-