public abstract class AFormElement
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static com.google.gson.Gson |
GSON |
protected java.util.function.Function<java.lang.String,java.lang.String> |
translator |
| Constructor and Description |
|---|
AFormElement(FormElementType type,
java.lang.String text) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
deserialize(com.google.gson.JsonElement element)
Deserialize the element from a json element.
|
java.lang.String |
getText() |
java.lang.String |
getText(boolean translate)
Get the text of the element.
|
java.util.function.Function<java.lang.String,java.lang.String> |
getTranslator() |
FormElementType |
getType() |
abstract com.google.gson.JsonElement |
serialize()
Serialize the element to a json element.
|
void |
setTranslator(java.util.function.Function<java.lang.String,java.lang.String> translator)
Set the translator for the element.
|
protected static final com.google.gson.Gson GSON
protected java.util.function.Function<java.lang.String,java.lang.String> translator
public AFormElement(FormElementType type, java.lang.String text)
public FormElementType getType()
public java.lang.String getText()
public java.lang.String getText(boolean translate)
translate - If the text should be translatedpublic void setTranslator(java.util.function.Function<java.lang.String,java.lang.String> translator)
translator - The translatorpublic java.util.function.Function<java.lang.String,java.lang.String> getTranslator()
@Nullable public abstract com.google.gson.JsonElement serialize()
public abstract void deserialize(com.google.gson.JsonElement element)
throws com.google.gson.JsonParseException
element - The serialized elementcom.google.gson.JsonParseException - If the element is not valid