Package activityconfig
Class ParsedStmt
- java.lang.Object
-
- activityconfig.ParsedStmt
-
public class ParsedStmt extends java.lang.ObjectAllow for uniform statement anchor parsing, using the?anchor
and{anchor}anchoring conventions. This type also includes all of the properties from the enclosed StmtDef, in addition to a couple of helpers. It should allow programmers to project this type directly from an existingStmtDefas a substitute.
-
-
Constructor Summary
Constructors Constructor Description ParsedStmt(StmtDef stmtDef)Construct a new ParsedStatement from the provided stmtDef and anchor token.
-
Method Summary
Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>getBindings()java.util.List<io.virtdata.templates.BindPoint>getBindPoints()java.util.Set<java.lang.String>getExtraBindings()The list of binding names returned by this method does not constitute an error.java.util.Set<java.lang.String>getMissingBindings()Returns a list of binding names which were referenced in eitherjava.lang.StringgetName()java.util.Map<java.lang.String,java.lang.String>getParams()java.lang.StringgetPositionalStatement(java.util.function.Function<java.lang.String,java.lang.String> tokenMapper)Return the statement that can be used as-is by any driver specific version.java.util.Map<java.lang.String,java.lang.String>getSpecificBindings()Return a map of bindings which were referenced in the statement.java.lang.StringgetStmt()java.util.Map<java.lang.String,java.lang.String>getTags()booleanhasError()ParsedStmtorError()java.lang.StringtoString()
-
-
-
Constructor Detail
-
ParsedStmt
public ParsedStmt(StmtDef stmtDef)
Construct a new ParsedStatement from the provided stmtDef and anchor token.- Parameters:
stmtDef- An existing statement def as read from the YAML API.
-
-
Method Detail
-
orError
public ParsedStmt orError()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hasError
public boolean hasError()
- Returns:
- true if the parsed statement is not usable.
-
getExtraBindings
public java.util.Set<java.lang.String> getExtraBindings()
The list of binding names returned by this method does not constitute an error. They may be used for for informational purposes in error handlers, for example.- Returns:
- a set of bindings names which were provided to
this parsed statement, but which were not referenced
in either
{anchor}or?anchor
form.
-
getMissingBindings
public java.util.Set<java.lang.String> getMissingBindings()
Returns a list of binding names which were referenced in either{anchor}or?anchor
form, but which were not present in the provided bindings map. If any binding names are present in the returned set, then this binding will not be usable.- Returns:
- A list of binding names which were referenced but not defined*
-
getSpecificBindings
public java.util.Map<java.lang.String,java.lang.String> getSpecificBindings()
Return a map of bindings which were referenced in the statement. This is an easy way to get the list of effective bindings for a statement for diagnostic purposes without including a potentially long list of library bindings.- Returns:
- a bindings map of referenced bindings in the statement
-
getPositionalStatement
public java.lang.String getPositionalStatement(java.util.function.Function<java.lang.String,java.lang.String> tokenMapper)
Return the statement that can be used as-is by any driver specific version. This uses the anchor token as provided to yield a version of the statement which contains positional anchors, but no named bindings.- Parameters:
tokenMapper- A function which maps the anchor name to the needed form in the callers driver context- Returns:
- A driver or usage-specific format of the statement, with anchors
-
getName
public java.lang.String getName()
- Returns:
- the statement name from the enclosed
StmtDef
-
getStmt
public java.lang.String getStmt()
- Returns:
- the raw statement from the enclosed
StmtDef
-
getTags
public java.util.Map<java.lang.String,java.lang.String> getTags()
- Returns:
- the tags from the enclosed
StmtDef
-
getBindings
public java.util.Map<java.lang.String,java.lang.String> getBindings()
- Returns:
- the bindings from the enclosed
StmtDef
-
getParams
public java.util.Map<java.lang.String,java.lang.String> getParams()
- Returns:
- the params from the enclosed
StmtDef
-
getBindPoints
public java.util.List<io.virtdata.templates.BindPoint> getBindPoints()
-
-