MessageDefinition.java
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*/
package net.sourceforge.plantuml.error.messages;
/**
* One entry of the {@code messages} section of messages.yaml (or a message
* written inline in a rule), already validated.
*/
public final class MessageDefinition {
public static final int DEFAULT_FONT_SIZE = 14;
public static final int DEFAULT_QRCODE_SCALE = 2;
private final String id;
private final String background;
private final int fontSize;
private final String text;
private final String qrcode;
private final int qrcodeScale;
private final byte[] image;
private final ImagePosition imagePosition;
MessageDefinition(String id, String background, int fontSize, String text, String qrcode, int qrcodeScale,
byte[] image, ImagePosition imagePosition) {
this.id = id;
this.background = background;
this.fontSize = fontSize;
this.text = text;
this.qrcode = qrcode;
this.qrcodeScale = qrcodeScale;
this.image = image;
this.imagePosition = imagePosition;
}
public String getId() {
return id;
}
/** The background color as written in the file, or null. */
public String getBackground() {
return background;
}
public int getFontSize() {
return fontSize;
}
/** The Creole text, without its final line break, or null. */
public String getText() {
return text;
}
/** The URL to encode as a QR code, or null. */
public String getQrcode() {
return qrcode;
}
public int getQrcodeScale() {
return qrcodeScale;
}
/** The PNG image, or null. */
public byte[] getImage() {
return image == null ? null : image.clone();
}
public ImagePosition getImagePosition() {
return imagePosition;
}
}