Package io.permazen.parse.func
Interface Function
-
- All Known Implementing Classes:
AbstractFunction
,AllFunction
,ConcatFunction
,CountFunction
,CreateFunction
,DumpFunction
,LimitFunction
,ListFunction
,PrintFunction
,QueryCompositeIndexFunction
,QueryIndexFunction
,QueryListElementIndexFunction
,QueryMapValueIndexFunction
,QueryVersionFunction
,SessionFunction
,SimpleCliFunction
,SimpleFunction
,UpgradeFunction
,VersionFunction
public interface Function
Function hook in aParseSession
.- See Also:
AbstractFunction
,SimpleFunction
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Value
apply(ParseSession session, Object params)
Evaluate this function.String
getHelpDetail()
Get expanded help (typically multiple lines).String
getHelpSummary()
Get summarized help (typically a single line).String
getName()
Get the name of this function.EnumSet<SessionMode>
getSessionModes()
Get theSessionMode
(s) supported by this function.String
getUsage()
Get function usage string.Object
parseParams(ParseSession session, ParseContext ctx, boolean complete)
Parse function parameters.
-
-
-
Method Detail
-
getName
String getName()
Get the name of this function.- Returns:
- function name
-
getUsage
String getUsage()
Get function usage string. For example:pow(base, exponent)
.- Returns:
- function usage string
-
getHelpSummary
String getHelpSummary()
Get summarized help (typically a single line).- Returns:
- one line summarized description of this function
-
getHelpDetail
String getHelpDetail()
Get expanded help (typically multiple lines). May refer to the usage string.The implementation in
AbstractFunction
delegates togetHelpSummary()
.- Returns:
- detailed description of this function
-
getSessionModes
EnumSet<SessionMode> getSessionModes()
Get theSessionMode
(s) supported by this function.- Returns:
- set of supported
SessionMode
s
-
parseParams
Object parseParams(ParseSession session, ParseContext ctx, boolean complete)
Parse function parameters.The
ctx
will be pointing at the first parameter (if any) or closing parenthesis. This method should parse (but not evaluate) function parameters up through the closing parenthesis. The return value is an opaque value representing the parsed parameters and subsequently passed toapply()
.- Parameters:
session
- parse sessionctx
- parse contextcomplete
- false if parse is "for real", true if only for tab completion calculation- Returns:
- parsed parameters object to be passed to
apply()
- Throws:
ParseException
- if parse fails, or ifcomplete
is true and there are valid completions
-
apply
Value apply(ParseSession session, Object params)
Evaluate this function. There will be a transaction open.- Parameters:
session
- parse sessionparams
- parsed parameters returned byparseParams()
- Returns:
- value returned by this function
- Throws:
RuntimeException
- if there is an error
-
-