Package xyz.gmitch215.socketmc.util
Interface Paramaterized
- All Known Implementing Classes:
DrawingContext.Command
,DrawingContext.Modifier
,Instruction
,Toast
public interface Paramaterized
Represents an object that holds parameters.
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
booleanParameter
(int index) Gets a parameter as a boolean.default boolean
booleanParameter
(int index, boolean def) Gets a parameter as a boolean.default double
doubleParameter
(int index) Gets a parameter as a double.default double
doubleParameter
(int index, double def) Gets a parameter as a double.default boolean
Gets the first parameter as a boolean.default double
Gets the first parameter as a double.default float
Gets the first parameter as a float.default int
Gets the first parameter as an integer.default long
Gets the first parameter as a long.default Object
Gets the first parameter.default <T> T
firstParameter
(@NotNull Class<T> type) Gets the first parameter.Gets the first parameter as a string.default float
floatParameter
(int index) Gets a parameter as a float.default float
floatParameter
(int index, float def) Gets a parameter as a float.Gets an immutable copy of the parameters.default <T> List
<T> getParameters
(@NotNull Class<T> type) Gets the parameters of the specified type.default int
intParameter
(int index) Gets a parameter as an integer.default int
intParameter
(int index, int def) Gets a parameter as an integer.default boolean
Gets the last parameter as a boolean.default double
Gets the last parameter as a double.default float
Gets the last parameter as a float.default int
Gets the last parameter as an integer.default long
Gets the last parameter as a long.default Object
Gets the last parameter.default <T> T
lastParameter
(@NotNull Class<T> type) Gets the last parameter.Gets the last parameter as a string.default long
longParameter
(int index) Gets a parameter as a long.default long
longParameter
(int index, long def) Gets a parameter as a long.parameter
(int index) Gets the parameter at the specified index.default <T> T
Gets the parameter at the specified index.default <T> T
Gets the parameter at the specified index.stringParameter
(int index) Gets a parameter as a string.stringParameter
(int index, @NotNull String def) Gets a parameter as a string.
-
Method Details
-
getParameters
Gets an immutable copy of the parameters.- Returns:
- Object Parameters
-
getParameters
Gets the parameters of the specified type.- Type Parameters:
T
- The type of the parameters- Parameters:
type
- The type of the parameters to get- Returns:
- The parameters of the specified type
-
parameter
Gets the parameter at the specified index.- Parameters:
index
- The index of the parameter to get- Returns:
- The parameter at the specified index
- Throws:
IllegalArgumentException
- if the index is out of bounds
-
firstParameter
Gets the first parameter.- Returns:
- The first parameter
-
lastParameter
Gets the last parameter.- Returns:
- The last parameter
-
parameter
@NotNull default <T> T parameter(int index, @NotNull @NotNull Class<T> type) throws IllegalArgumentException Gets the parameter at the specified index.- Type Parameters:
T
- The type of the parameter- Parameters:
index
- The index of the parameter to get- Returns:
- The parameter at the specified index
- Throws:
IllegalArgumentException
- if the index is out of bounds or type is null
-
parameter
@NotNull default <T> T parameter(int index, @NotNull @NotNull Class<T> type, @NotNull T def) throws IllegalArgumentException Gets the parameter at the specified index.- Type Parameters:
T
- The type of the parameter- Parameters:
index
- The index of the parameter to gettype
- The type of the parameterdef
- The default value to return if the parameter is null- Returns:
- The parameter at the specified index
- Throws:
IllegalArgumentException
- if the index is out of bounds, type is null, or def is null
-
firstParameter
@NotNull default <T> T firstParameter(@NotNull @NotNull Class<T> type) throws IllegalArgumentException Gets the first parameter.- Type Parameters:
T
- The type of the parameter- Parameters:
type
- The type of the parameter- Returns:
- The first parameter
- Throws:
IllegalArgumentException
- if type is null
-
lastParameter
@NotNull default <T> T lastParameter(@NotNull @NotNull Class<T> type) throws IllegalArgumentException Gets the last parameter.- Type Parameters:
T
- The type of the parameter- Parameters:
type
- The type of the parameter- Returns:
- The last parameter
- Throws:
IllegalArgumentException
- if type is null
-
intParameter
default int intParameter(int index) Gets a parameter as an integer.- Parameters:
index
- The index of the parameter to get- Returns:
- The parameter at the specified index as an integer
-
intParameter
default int intParameter(int index, int def) Gets a parameter as an integer.- Parameters:
index
- The index of the parameter to getdef
- The default value to return if the parameter is null- Returns:
- The parameter at the specified index as an integer
-
firstIntParameter
default int firstIntParameter()Gets the first parameter as an integer.- Returns:
- The first parameter as an integer
-
lastIntParameter
default int lastIntParameter()Gets the last parameter as an integer.- Returns:
- The last parameter as an integer
-
longParameter
default long longParameter(int index) Gets a parameter as a long.- Parameters:
index
- The index of the parameter to get- Returns:
- The parameter at the specified index as a long
-
longParameter
default long longParameter(int index, long def) Gets a parameter as a long.- Parameters:
index
- The index of the parameter to getdef
- The default value to return if the parameter is null- Returns:
- The parameter at the specified index as a long
-
firstLongParameter
default long firstLongParameter()Gets the first parameter as a long.- Returns:
- The first parameter as a long
-
lastLongParameter
default long lastLongParameter()Gets the last parameter as a long.- Returns:
- The last parameter as a long
-
floatParameter
default float floatParameter(int index) Gets a parameter as a float.- Parameters:
index
- The index of the parameter to get- Returns:
- The parameter at the specified index as a float
-
floatParameter
default float floatParameter(int index, float def) Gets a parameter as a float.- Parameters:
index
- The index of the parameter to getdef
- The default value to return if the parameter is null- Returns:
- The parameter at the specified index as a float
-
firstFloatParameter
default float firstFloatParameter()Gets the first parameter as a float.- Returns:
- The first parameter as a float
-
lastFloatParameter
default float lastFloatParameter()Gets the last parameter as a float.- Returns:
- The last parameter as a float
-
doubleParameter
default double doubleParameter(int index) Gets a parameter as a double.- Parameters:
index
- The index of the parameter to get- Returns:
- The parameter at the specified index as a double
-
doubleParameter
default double doubleParameter(int index, double def) Gets a parameter as a double.- Parameters:
index
- The index of the parameter to getdef
- The default value to return if the parameter is null- Returns:
- The parameter at the specified index as a double
-
firstDoubleParameter
default double firstDoubleParameter()Gets the first parameter as a double.- Returns:
- The first parameter as a double
-
lastDoubleParameter
default double lastDoubleParameter()Gets the last parameter as a double.- Returns:
- The last parameter as a double
-
booleanParameter
default boolean booleanParameter(int index) Gets a parameter as a boolean.- Parameters:
index
- The index of the parameter to get- Returns:
- The parameter at the specified index as a boolean
-
booleanParameter
default boolean booleanParameter(int index, boolean def) Gets a parameter as a boolean.- Parameters:
index
- The index of the parameter to getdef
- The default value to return if the parameter is null- Returns:
- The parameter at the specified index as a boolean
-
firstBooleanParameter
default boolean firstBooleanParameter()Gets the first parameter as a boolean.- Returns:
- The first parameter as a boolean
-
lastBooleanParameter
default boolean lastBooleanParameter()Gets the last parameter as a boolean.- Returns:
- The last parameter as a boolean
-
stringParameter
Gets a parameter as a string.- Parameters:
index
- The index of the parameter to get- Returns:
- The parameter at the specified index as a string
-
stringParameter
Gets a parameter as a string.- Parameters:
index
- The index of the parameter to getdef
- The default value to return if the parameter is null- Returns:
- The parameter at the specified index as a string
-
firstStringParameter
Gets the first parameter as a string.- Returns:
- The first parameter as a string
-
lastStringParameter
Gets the last parameter as a string.- Returns:
- The last parameter as a string
-