Class PermissionBackendCondition
java.lang.Object
com.google.gerrit.extensions.conditions.BooleanCondition
com.google.gerrit.extensions.conditions.PrivateInternals_BooleanCondition.SubclassOnlyInCoreServer
com.google.gerrit.server.permissions.PermissionBackendCondition
- Direct Known Subclasses:
PermissionBackendCondition.ForChange
,PermissionBackendCondition.ForProject
,PermissionBackendCondition.ForRef
,PermissionBackendCondition.WithUser
public abstract class PermissionBackendCondition
extends PrivateInternals_BooleanCondition.SubclassOnlyInCoreServer
BooleanCondition
to evaluate a permission.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
-
Field Summary
Fields inherited from class com.google.gerrit.extensions.conditions.BooleanCondition
FALSE, TRUE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if the condition evaluates to eithertrue
orfalse
without providing additional information to the evaluation tree, e.g.reduce()
Reduce evaluation tree by cutting off branches that evaluate trivially and replacing them with a leave note corresponding to the value the branch evaluated to.void
set
(boolean val) Assign a specifictestOrFalse
result to this condition.abstract String
toString()
Methods inherited from class com.google.gerrit.extensions.conditions.PrivateInternals_BooleanCondition.SubclassOnlyInCoreServer
children
-
Constructor Details
-
PermissionBackendCondition
public PermissionBackendCondition()
-
-
Method Details
-
set
public void set(boolean val) Assign a specifictestOrFalse
result to this condition.By setting the condition to a specific value the condition will bypass calling
PermissionBackend
duringvalue()
, and immediately return the set value instead.- Parameters:
val
- value to return fromvalue()
.
-
toString
-
evaluatesTrivially
public boolean evaluatesTrivially()Description copied from class:BooleanCondition
Check if the condition evaluates to eithertrue
orfalse
without providing additional information to the evaluation tree, e.g. through checks to a remote service such asPermissionBackend
.In this case, the tree can be reduced to skip all non-trivial checks resulting in a performance gain.
- Specified by:
evaluatesTrivially
in classBooleanCondition
-
reduce
Description copied from class:BooleanCondition
Reduce evaluation tree by cutting off branches that evaluate trivially and replacing them with a leave note corresponding to the value the branch evaluated to.Example 1 (T=True, F=False, C=non-trivial check): OR / \ => T C T Example 2 (cuts off a not-trivial check): AND / \ => F C F Example 3: AND / \ => F T F
There is no guarantee that the resulting tree is minimal. The only guarantee made is that branches that evaluate trivially will be cut off and replaced by primitive values.
- Specified by:
reduce
in classBooleanCondition
-