Package dev.cel.common
Class CelValidationResult
- java.lang.Object
-
- dev.cel.common.CelValidationResult
-
@Immutable public final class CelValidationResult extends java.lang.Object
CelValidationResult encapsulates theCelAbstractSyntaxTree
andCelIssue
set which may be generated during the parse and check phases.
-
-
Constructor Summary
Constructors Constructor Description CelValidationResult(CelAbstractSyntaxTree ast, com.google.common.collect.ImmutableList<CelIssue> issues)
Internal: Consumers should not be creating an instance of this class on their ownCelValidationResult(CelSource source, com.google.common.collect.ImmutableList<CelIssue> issues)
Internal: Consumers should not be creating an instance of this class directly.CelValidationResult(CelSource source, java.lang.Throwable failure, com.google.common.collect.ImmutableList<CelIssue> issues)
Internal: Consumers should not be creating an instance of this class directly.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description com.google.common.collect.ImmutableList<CelIssue>
getAllIssues()
Return allCelIssue
s encountered durint validation.CelAbstractSyntaxTree
getAst()
Returns the validatedCelAbstractSyntaxTree
if one exists.java.lang.String
getDebugString()
Deprecated.UsegetIssueString()
instead.com.google.common.collect.ImmutableList<CelIssue>
getErrors()
Return the set ofCelIssue
s with anERROR
severity.java.lang.String
getErrorString()
Convert theCelIssue
s withERROR
severity to an error string.java.lang.String
getIssueString()
Convert all issues to a human-readable string.CelSource
getSource()
Return theCelSource
associated with the result.boolean
hasError()
Whether aCelIssue
with anCelIssue.Severity.ERROR
severity was encountered during validation.
-
-
-
Constructor Detail
-
CelValidationResult
@Internal public CelValidationResult(CelSource source, com.google.common.collect.ImmutableList<CelIssue> issues)
Internal: Consumers should not be creating an instance of this class directly.
-
CelValidationResult
@Internal public CelValidationResult(CelSource source, java.lang.Throwable failure, com.google.common.collect.ImmutableList<CelIssue> issues)
Internal: Consumers should not be creating an instance of this class directly.
-
CelValidationResult
@Internal public CelValidationResult(CelAbstractSyntaxTree ast, com.google.common.collect.ImmutableList<CelIssue> issues)
Internal: Consumers should not be creating an instance of this class on their own
-
-
Method Detail
-
getAst
@CanIgnoreReturnValue public CelAbstractSyntaxTree getAst() throws CelValidationException
Returns the validatedCelAbstractSyntaxTree
if one exists.When
hasError
returnstrue
, this accessor will throw aCelValidationException
containing the error set which prevented AST generation.- Throws:
CelValidationException
-
getSource
public CelSource getSource()
Return theCelSource
associated with the result.
-
hasError
public boolean hasError()
Whether aCelIssue
with anCelIssue.Severity.ERROR
severity was encountered during validation.
-
getErrors
public com.google.common.collect.ImmutableList<CelIssue> getErrors()
Return the set ofCelIssue
s with anERROR
severity.
-
getAllIssues
public com.google.common.collect.ImmutableList<CelIssue> getAllIssues()
Return allCelIssue
s encountered durint validation.
-
getIssueString
public java.lang.String getIssueString()
Convert all issues to a human-readable string.
-
getDebugString
@Deprecated @InlineMe(replacement="this.getIssueString()") public java.lang.String getDebugString()
Deprecated.UsegetIssueString()
instead.Convert theCelIssue
set to a debug string.
-
getErrorString
public java.lang.String getErrorString()
Convert theCelIssue
s withERROR
severity to an error string.
-
-