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
ConstructorsConstructorDescriptionEnumFunctionResolver(Enum<? extends ScriptFunctionType>... en) Creates a new resolver using a list of enum values. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsFunction(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:ScriptFunctionResolverAttempts 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 returnfalseif called with that name!The same function must be returned if this is called again with the same name!
- Specified by:
getFunctionin interfaceScriptFunctionResolver- Parameters:
name- the name to resolve.- Returns:
- a corresponding function or null for no such function.
- See Also:
-
containsFunction
Description copied from interface:ScriptFunctionResolverAttempts to find if this resolver has a function by its calling name.Names must be resolved case-insensitively!
If this returns
truefor a function name,ScriptFunctionResolver.getFunction(String)must NOT return null if called with that name!- Specified by:
containsFunctionin interfaceScriptFunctionResolver- Parameters:
name- the name to find.- Returns:
- a corresponding function or null for no such function.
-
getFunctions
Description copied from interface:ScriptFunctionResolverGets the full list of all script functions. Depending on the implementation, this may be an expensive lookup.- Specified by:
getFunctionsin interfaceScriptFunctionResolver- Returns:
- a list of all functions.
-