54 lines
1.1 KiB
Java
54 lines
1.1 KiB
Java
package com.yutou.napcat.handle;
|
|
|
|
import lombok.Data;
|
|
|
|
import java.lang.reflect.Type;
|
|
|
|
public class Text extends BaseHandle<Text.TextInfo> {
|
|
|
|
public Text() {
|
|
super("text");
|
|
}
|
|
|
|
public Text(String text) {
|
|
super("text");
|
|
data = new TextInfo(text + "\n");
|
|
}
|
|
|
|
public Text(String text, boolean isNewLine) {
|
|
super("text");
|
|
if (isNewLine) {
|
|
data = new TextInfo(text + "\n");
|
|
} else {
|
|
data = new TextInfo(text);
|
|
}
|
|
}
|
|
|
|
public Text(boolean isNewLine, String... text) {
|
|
super("text");
|
|
StringBuilder sb = new StringBuilder();
|
|
for (String s : text) {
|
|
sb.append(s);
|
|
}
|
|
if (isNewLine) {
|
|
data = new TextInfo(sb + "\n");
|
|
} else {
|
|
data = new TextInfo(sb.toString());
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return data.text.trim();
|
|
}
|
|
|
|
@Data
|
|
public static class TextInfo {
|
|
String text;
|
|
|
|
public TextInfo(String text) {
|
|
this.text = text.trim();
|
|
}
|
|
}
|
|
}
|