public class Message extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Message.Type
Severity for a message
|
Constructor and Description |
---|
Message()
Default constructor needed for JAXB
|
Message(Message.Type type,
String message)
Simple constructor for a message.
|
Message(Message.Type type,
String fieldName,
String message)
Constructor for a message for a specific REST model field.
|
Message(Message.Type type,
String message,
String image,
long timestamp)
Constructor for a Message with an image and a timestamp.
|
Message(Message.Type type,
String fieldName,
String message,
String image,
long timestamp)
Constructor with all parameters.
|
Modifier and Type | Method and Description |
---|---|
String |
getFieldName()
The name of the REST model field this message is about.
|
Integer |
getId()
Get the message id
|
String |
getImage() |
String |
getMessage() |
User |
getSender()
Get the sender of the message
|
long |
getTimestamp() |
Message.Type |
getType() |
boolean |
isExpired(int instantTimeMinutes)
Helper function to determine if a message is an instant message.
|
void |
setFieldName(String fieldName)
Set the name of the REST model field this message is about.
|
void |
setId(Integer id)
Set the message id
|
void |
setImage(String image) |
void |
setInstantMessage(boolean instantMessage)
Sets the value of the isInstantMessage variable.
|
void |
setMessage(String message) |
void |
setSender(User sender)
Set the sender of the message
|
void |
setTimestamp(long timestamp) |
void |
setType(Message.Type type) |
String |
toString() |
public Message()
public Message(Message.Type type, String fieldName, String message, String image, long timestamp)
type
- The Message.Type
of the message.fieldName
- The name of the REST model field this message is about.message
- The text of the message.image
- The URL of the image that should be displayed aside the message.timestamp
- The timestamp of the message.public Message(Message.Type type, String fieldName, String message)
image
will be null
and the timestamp
will be set to the current time.type
- The type of the message.fieldName
- The name of the REST model field this message is about.message
- The text of the message.public Message(Message.Type type, String message, String image, long timestamp)
type
- Type of the messagemessage
- Text of the messageimage
- URL of the image that should be displayed aside the messagepublic Message(Message.Type type, String message)
type
- Type of the messagemessage
- Text of the messagepublic String getFieldName()
null
if this message is not about a specific
REST model field.public void setFieldName(String fieldName)
fieldName
- Set the name of the REST model field this message is
about (can be null).public String getMessage()
public void setMessage(String message)
public Message.Type getType()
public void setType(Message.Type type)
public long getTimestamp()
public void setTimestamp(long timestamp)
public String getImage()
public void setImage(String image)
public User getSender()
public void setSender(User sender)
sender
- message senderpublic void setId(Integer id)
id
- id of the messagepublic Integer getId()
public boolean isExpired(int instantTimeMinutes)
public void setInstantMessage(boolean instantMessage)
instantMessage
- a boolean value that represents if the message is instantCopyright © 2024 Gentics Software. All rights reserved.