public class IntegerParameter<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends AbstractValuePluginParameter<G,A,R,java.lang.Integer>
PluginParameter
that holds an integer value and a range of valid
values.Modifier and Type | Field and Description |
---|---|
static @NotNull java.lang.String |
PARAMETER_TYPE
The string representation of this parameter type.
|
Constructor and Description |
---|
IntegerParameter()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getMax()
Returns the maximal allowed value.
|
int |
getMin()
Returns the minimal allowed value.
|
@NotNull java.lang.String |
getParameterType()
Returns the parameter type name.
|
@NotNull java.lang.String |
getStringValue()
Returns the string representation of the current value of the parameter.
|
void |
setMax(int max)
Sets the maximal allowed value.
|
void |
setMin(int min)
Sets the minimal allowed value.
|
boolean |
setStringValue(@NotNull java.lang.String stringValue)
Sets the parameter value from string representation.
|
void |
setValue(@NotNull java.lang.Integer value)
Updates the parameter value.
|
<T> T |
visit(@NotNull PluginParameterVisitor<G,A,R,T> visitor)
Calls the
visit() function for this parameter type. |
getValue, getValueOrNull
addPluginParameterListener, changed, getDescription, getName, removePluginParameterListener, setDescription, setName
@NotNull public static final @NotNull java.lang.String PARAMETER_TYPE
@NotNull public <T> T visit(@NotNull @NotNull PluginParameterVisitor<G,A,R,T> visitor)
PluginParameter
visit()
function for this parameter type.T
- the visitor-specific type of the return valuevisitor
- the visitor to callpublic boolean setStringValue(@NotNull @NotNull java.lang.String stringValue)
PluginParameter
stringValue
- the string representation of the value to settrue
if the value was accepted or false
if the
value was not changed because the new value is invalidpublic void setValue(@NotNull @NotNull java.lang.Integer value)
AbstractValuePluginParameter
setValue
in class AbstractValuePluginParameter<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>,java.lang.Integer>
value
- the new value@NotNull public @NotNull java.lang.String getParameterType()
PluginParameter
@NotNull public @NotNull java.lang.String getStringValue()
PluginParameter
public int getMax()
public void setMax(int max)
max
- the maximal allowed valuepublic int getMin()
public void setMin(int min)
min
- the minimal allowed value