Package com.blackrook.rookscript.lang
Class ScriptFunctionUsage
java.lang.Object
com.blackrook.rookscript.lang.ScriptFunctionUsage
- All Implemented Interfaces:
ScriptFunctionType.Usage
Function usage builder.
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.blackrook.rookscript.lang.ScriptFunctionType.Usage
ScriptFunctionType.Usage.ParameterUsage, ScriptFunctionType.Usage.TypeUsage
-
Method Summary
Modifier and TypeMethodDescriptionstatic ScriptFunctionUsage
create()
Gets the function usage instructions.Gets the usage instructions per function parameter, in the order of the functions parameters.Gets a list of accepted, expected return types for this function.instructions
(String instructions) Sets the instructions.parameter
(String name, ScriptFunctionType.Usage.TypeUsage... usages) Adds a parameter's usage.returns
(ScriptFunctionType.Usage.TypeUsage... typeUsages) Adds return types.type
(ScriptValue.Type type, String description) Creates a single type usage.type
(ScriptValue.Type type, String objectRefType, String description) Creates a single type usage.Creates a single type usage.
-
Method Details
-
create
- Returns:
- a new usage description.
-
type
Creates a single type usage.- Parameters:
description
- its description.- Returns:
- a new type usage.
-
type
Creates a single type usage.- Parameters:
type
- the script value type.description
- its description.- Returns:
- a new type usage.
-
type
public static ScriptFunctionType.Usage.TypeUsage type(ScriptValue.Type type, String objectRefType, String description) Creates a single type usage.- Parameters:
type
- the script value type.objectRefType
- if type isScriptValue.Type.OBJECTREF
, then this is the expected Object type.description
- its description.- Returns:
- a new type usage.
-
instructions
Sets the instructions.- Parameters:
instructions
- the new instructions.- Returns:
- itself.
-
parameter
Adds a parameter's usage.- Parameters:
name
- the parameter name.usages
- each accepted type and its description.- Returns:
- itself.
-
returns
Adds return types.- Parameters:
typeUsages
- each returned type and its description.- Returns:
- itself.
-
getInstructions
Description copied from interface:ScriptFunctionType.Usage
Gets the function usage instructions.- Specified by:
getInstructions
in interfaceScriptFunctionType.Usage
- Returns:
- the function usage instructions. Never returns null.
-
getParameterInstructions
Description copied from interface:ScriptFunctionType.Usage
Gets the usage instructions per function parameter, in the order of the functions parameters. Can be null for no instructions. Must match function's parameter count.- Specified by:
getParameterInstructions
in interfaceScriptFunctionType.Usage
- Returns:
- the usage instructions per function parameter. Never returns null.
- See Also:
-
getReturnTypes
Description copied from interface:ScriptFunctionType.Usage
Gets a list of accepted, expected return types for this function.- Specified by:
getReturnTypes
in interfaceScriptFunctionType.Usage
- Returns:
- the list of return types. Never returns null.
-