net.nemerosa.ontrack.model.support.MessageAnnotation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-model Show documentation
Show all versions of ontrack-model Show documentation
Ontrack module: ontrack-model
package net.nemerosa.ontrack.model.support;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.HashMap;
import java.util.Map;
@Data
@AllArgsConstructor(access = AccessLevel.PROTECTED)
public class MessageAnnotation {
private final String type;
private final String text;
private final Map attributes;
public static MessageAnnotation of(String type) {
return new MessageAnnotation(type, null, new HashMap());
}
public static MessageAnnotation t(String text) {
return of(null).text(text);
}
public MessageAnnotation attr(String name, String value) {
attributes.put(name, value);
return this;
}
public String attr(String name) {
return attributes.get(name);
}
public MessageAnnotation text(String text) {
return new MessageAnnotation(type, text, attributes);
}
public boolean isText() {
return type == null;
}
public boolean hasText() {
return StringUtils.isNotBlank(text);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy