Class EnumFunctionResolver
java.lang.Object
com.blackrook.rookscript.resolvers.hostfunction.EnumFunctionResolver
- All Implemented Interfaces:
ScriptFunctionResolver
A special kind of host function resolver that wraps an
Enum
of ScriptFunctionType
.- Author:
- Matthew Tropiano
-
Field Summary
Fields inherited from interface com.blackrook.rookscript.resolvers.ScriptFunctionResolver
EMPTY
-
Constructor Summary
ConstructorDescriptionEnumFunctionResolver
(Enum<? extends ScriptFunctionType>... en) Creates a new resolver using a list of enum values. -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsFunction
(String name) Attempts to find if this resolver has a function by its calling name.getFunction
(String name) Attempts to resolve a pertinent function by its calling name.Gets the full list of all script functions.
-
Constructor Details
-
EnumFunctionResolver
Creates a new resolver using a list of enum values.- Parameters:
en
- the list of enum values (usually Enum.values()).
-
-
Method Details
-
getFunction
Description copied from interface:ScriptFunctionResolver
Attempts to resolve a pertinent function by its calling name.Names must be resolved case-insensitively!
If this returns a non-null for a function name,
ScriptFunctionResolver.containsFunction(String)
must NOT returnfalse
if called with that name!The same function must be returned if this is called again with the same name!
- Specified by:
getFunction
in interfaceScriptFunctionResolver
- Parameters:
name
- the name to resolve.- Returns:
- a corresponding function or null for no such function.
- See Also:
-
containsFunction
Description copied from interface:ScriptFunctionResolver
Attempts to find if this resolver has a function by its calling name.Names must be resolved case-insensitively!
If this returns
true
for a function name,ScriptFunctionResolver.getFunction(String)
must NOT return null if called with that name!- Specified by:
containsFunction
in interfaceScriptFunctionResolver
- Parameters:
name
- the name to find.- Returns:
- a corresponding function or null for no such function.
-
getFunctions
Description copied from interface:ScriptFunctionResolver
Gets the full list of all script functions. Depending on the implementation, this may be an expensive lookup.- Specified by:
getFunctions
in interfaceScriptFunctionResolver
- Returns:
- a list of all functions.
-