nl.tudelft.ewi.auta.srf.model.Note Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of auta-srf Show documentation
Show all versions of auta-srf Show documentation
A facade for metric script executors
The newest version!
package nl.tudelft.ewi.auta.srf.model;
import javax.annotation.Nullable;
import java.util.Objects;
/**
* A note generated by a script.
*
* Notes usually contain messages, but they can also be {@code null} to ensure compatibility with
* Spring data serialization techniques.
*
*/
public class Note {
/**
* The severity of the note.
*/
@Nullable
private Severity severity;
/**
* The message for the note.
*/
@Nullable
private String message;
/**
* The access level for the note.
*/
@Nullable
private AccessLevel accessLevel;
/**
* Creates a new note without a message.
*/
public Note() {
this(null, null, null);
}
/**
* Creates a new note.
*
* @param severity the severity
* @param message the message
*
* @deprecated new notes should include an access level, use
* {@link #Note(Severity, String, AccessLevel)} instead
*/
@Deprecated
public Note(final @Nullable Severity severity, final @Nullable String message) {
this(severity, message, null);
}
/**
* Creates a new note.
*
* @param severity the severity
* @param message the message
* @param accessLevel the access level
*/
public Note(
final @Nullable Severity severity,
final @Nullable String message,
final @Nullable AccessLevel accessLevel
) {
this.severity = severity;
this.message = message;
this.accessLevel = accessLevel;
}
/**
* Returns the message for the note.
*
* @return the message or {@code null} if no message was set
*/
@Nullable
public String getMessage() {
return message;
}
/**
* Sets the message for the note.
*
* @param message the message or {@code null} to clear the message
*/
public void setMessage(final @Nullable String message) {
this.message = message;
}
/**
* Returns the severity of the note.
*
* @return the severity or {@code null} if no severity was set
*/
@Nullable
public Severity getSeverity() {
return this.severity;
}
/**
* Sets the severity of the note.
*
* @param severity the severity or {@code null} to clear the severity
*/
public void setSeverity(final @Nullable Severity severity) {
this.severity = severity;
}
/**
* Returns the access level of the note.
*
* @return the access level or {@code null} if no level was set
*/
@Nullable
public AccessLevel getAccessLevel() {
return this.accessLevel;
}
/**
* Sets the access level of the note.
*
* @param accessLevel the access level or {@code null} to clear the level
*/
public void setAccessLevel(final @Nullable AccessLevel accessLevel) {
this.accessLevel = accessLevel;
}
@Override
public final boolean equals(final Object obj) {
if (!(obj instanceof Note)) {
return false;
}
final var other = (Note) obj;
return Objects.equals(this.severity, other.severity)
&& Objects.equals(this.message, other.message)
&& this.accessLevel == other.accessLevel;
}
@Override
public final int hashCode() {
return Objects.hash(this.severity, this.message, this.accessLevel);
}
}