public abstract class SCMHeadObserver extends Object
SCMHead
and corresponding SCMRevision
details.Modifier and Type | Class and Description |
---|---|
static class |
SCMHeadObserver.AllFinished
An observer that wraps multiple observers and keeps observing as long as one of the wrapped observers wants to.
|
static class |
SCMHeadObserver.Any
An observer that picks the first revision it can find.
|
static class |
SCMHeadObserver.Collector
An observer that collects the observed
SCMHead s and SCMRevision s. |
static class |
SCMHeadObserver.Filter<O extends SCMHeadObserver>
A
SCMHeadObserver that filters the SCMHead instances that will be observed by the wrapped
SCMHeadObserver . |
static class |
SCMHeadObserver.Named
An observer that collects the
SCMRevision of a named SCMHead and then stops observing. |
static class |
SCMHeadObserver.None
An observer that is already finished.
|
static class |
SCMHeadObserver.OneFinished
An observer that wraps multiple observers and keeps observing until one of the wrapped observers stops observing.
|
static class |
SCMHeadObserver.Selector
An observer that collects the
SCMRevision of a specific SCMHead and then stops observing. |
static class |
SCMHeadObserver.Wrapped<O extends SCMHeadObserver>
Base class for an
SCMHeadObserver that wraps another SCMHeadObserver while allowing access to the
original observer via SCMHeadObserver.Wrapped.unwrap() . |
Constructor and Description |
---|
SCMHeadObserver() |
Modifier and Type | Method and Description |
---|---|
static SCMHeadObserver.AllFinished |
allOf(SCMHeadObserver... observers)
Wraps multiple observers returning a combined observer that remains observing as long as at least one of the
wrapped observers
is still observing.
|
static SCMHeadObserver.Any |
any()
Creates an observer that selects the first revision it finds.
|
static SCMHeadObserver.Collector |
collect()
Creates an observer that collects all the heads and revisions.
|
static <O extends SCMHeadObserver> |
filter(O delegate,
SCMHead... heads)
Creates an observer that filters a delegates observer to the specified heads
|
static SCMHeadObserver.OneFinished |
first(SCMHeadObserver... observers)
Wraps multiple observers returning a combined observer that remains observing until one of the wrapped observers
stops observing.
|
Set<SCMHead> |
getIncludes()
|
boolean |
isObserving()
Returns information about whether the observer wants more results.
|
static SCMHeadObserver.Named |
named(String headName)
Creates an observer that selects the revision of a specific head.
|
static SCMHeadObserver.None |
none()
Creates an observer that selects the first revision it finds.
|
abstract void |
observe(SCMHead head,
SCMRevision revision)
Observes a head and current revision.
|
static SCMHeadObserver.Selector |
select(SCMHead head)
Creates an observer that selects the revision of a specific head.
|
public abstract void observe(@NonNull SCMHead head, @NonNull SCMRevision revision) throws IOException, InterruptedException
head
- the head.revision
- the revision.IOException
- if processing of the observation could not be completed due to an IOException
.InterruptedException
- if processing of the observation was interruptedpublic boolean isObserving()
true
if the observer is still observing or false
to signal that it is ok to stop early.@CheckForNull public Set<SCMHead> getIncludes()
SCMHead
instances that this observer is interested in or null
if
interested in all SCMHead
instances.
Implementations should not assume that the getIncludes()
will be honoured.
This method is designed to provide a hint to SCMSource
implementations.
SCMHead
instances that this observer is interested in or null
.@NonNull public static SCMHeadObserver.AllFinished allOf(SCMHeadObserver... observers)
observers
- the observers to wrap.@NonNull public static SCMHeadObserver.OneFinished first(SCMHeadObserver... observers)
observers
- the observers to wrap.@NonNull public static SCMHeadObserver.Collector collect()
@NonNull public static SCMHeadObserver.Selector select(@NonNull SCMHead head)
head
- the head to watch out for.@NonNull public static <O extends SCMHeadObserver> SCMHeadObserver.Filter<O> filter(O delegate, SCMHead... heads)
O
- the type of observer that will be filtered.delegate
- the delegateheads
- the head to watch out for.@NonNull public static SCMHeadObserver.Named named(@NonNull String headName)
headName
- the head to watch out for.@NonNull public static SCMHeadObserver.Any any()
@NonNull public static SCMHeadObserver.None none()
Copyright © 2016–2022. All rights reserved.