Class EnumResolver
- java.lang.Object
-
- com.blackrook.expression.resolver.EnumResolver
-
- All Implemented Interfaces:
ExpressionFunctionResolver
public class EnumResolver extends Object implements ExpressionFunctionResolver
A special kind of function resolver that wraps anEnum
ofExpressionFunctionType
- Author:
- Matthew Tropiano
-
-
Constructor Summary
Constructors Constructor Description EnumResolver(Enum<? extends ExpressionFunctionType>... en)
Creates a new resolver using a list of enum values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsFunctionByName(String name)
Attempts to find if this resolver has a function by its calling name.ExpressionFunctionType
getFunctionByName(String name)
Attempts to resolve a pertinent function by its calling name.
-
-
-
Constructor Detail
-
EnumResolver
@SafeVarargs public EnumResolver(Enum<? extends ExpressionFunctionType>... en)
Creates a new resolver using a list of enum values.- Parameters:
en
- the list of enum values (usually Enum.values()).
-
-
Method Detail
-
getFunctionByName
public ExpressionFunctionType getFunctionByName(String name)
Description copied from interface:ExpressionFunctionResolver
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,
ExpressionFunctionResolver.containsFunctionByName(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:
getFunctionByName
in interfaceExpressionFunctionResolver
- Parameters:
name
- the name to resolve.- Returns:
- a corresponding function or null for no such function.
- See Also:
ExpressionFunctionResolver.containsFunctionByName(String)
-
containsFunctionByName
public boolean containsFunctionByName(String name)
Description copied from interface:ExpressionFunctionResolver
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,ExpressionFunctionResolver.getFunctionByName(String)
must NOT return null if called with that name!- Specified by:
containsFunctionByName
in interfaceExpressionFunctionResolver
- Parameters:
name
- the name to find.- Returns:
- a corresponding function or null for no such function.
-
-