Class RefUpdateContext
java.lang.Object
com.google.gerrit.server.update.context.RefUpdateContext
- All Implemented Interfaces:
- AutoCloseable
Passes additional information about an operation to the 
BatchRefUpdate#execute method.
 To pass the additional information RefUpdateContext, wraps a code into an open
 RefUpdateContext, e.g.:
 
 try(RefUpdateContext ctx = RefUpdateContext.open(RefUpdateType.CHANGE_MODIFICATION)) {
   ...
   // some code which modifies a ref using BatchRefUpdate.execute method
 }
 BatchRefUpdate#execute method is executed, it can get all opened contexts and
 use it for an additional actions, e.g. it can put it in the reflog.
 The information provided by this class is used internally in google.
The InMemoryRepositoryManager file makes some validation to ensure that RefUpdateContext is used correctly within the code (see thee validateRefUpdateContext method).
The class includes only operations from open-source gerrit and can be extended (see 
 TestActionRefUpdateContext for example how to extend it).
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumList of possible ref-update types.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes the current context.protected static final Deque<RefUpdateContext>Returns the justification for the operation.static com.google.common.collect.ImmutableList<RefUpdateContext>Returns the list of opened contexts; the first element is the outermost context.Returns the type ofRefUpdateContext.static booleanChecks if there is an open context of the given type.static RefUpdateContextopen(RefUpdateContext.RefUpdateType updateType) Opens a context of a give type.protected static <T extends RefUpdateContext>
 Topen(T ctx) Opens a provided context.static RefUpdateContextopenDirectPush(Optional<String> justification) Opens a direct push context with an optional justification.
- 
Constructor Details- 
RefUpdateContext
 
- 
- 
Method Details- 
openOpens a provided context.
- 
openOpens a context of a give type.
- 
openDirectPushOpens a direct push context with an optional justification.
- 
getOpenedContextsReturns the list of opened contexts; the first element is the outermost context.
- 
hasOpenChecks if there is an open context of the given type.
- 
getCurrent
- 
getUpdateTypeReturns the type ofRefUpdateContext.For descendants, always return RefUpdateContext.RefUpdateType.OTHER(except known descendants defined as nested classes).
- 
getJustificationReturns the justification for the operation.
- 
closepublic void close()Closes the current context.- Specified by:
- closein interface- AutoCloseable
 
 
-