Module is.codion.common.reactive
Interface Observer.Builder<T,B extends Observer.Builder<T,B>>
- Type Parameters:
T- the observed typeB- the builder type
- All Known Subinterfaces:
Value.Builder<T,,B> ValueCollection.Builder<T,,C, B> ValueList.Builder<T>,ValueSet.Builder<T>
- All Known Implementing Classes:
AbstractObserver.AbstractBuilder,AbstractValue.AbstractBuilder
public static interface Observer.Builder<T,B extends Observer.Builder<T,B>>
Builds an
Observer-
Method Summary
Modifier and TypeMethodDescriptionbuild()weakConsumer(Consumer<? super T> weakConsumer) weakListener(Runnable weakListener) Adds a conditional listenerAdds a conditional consumerAdds a conditional listenerAdds a conditional consumer
-
Method Details
-
listener
- Parameters:
listener- a listener to add- Returns:
- this builder instance
-
consumer
- Parameters:
consumer- a consumer to add- Returns:
- this builder instance
-
weakListener
- Parameters:
weakListener- a weak listener to add- Returns:
- this builder instance
-
weakConsumer
- Parameters:
weakConsumer- a weak consumer to add- Returns:
- this builder instance
-
when
Adds a conditional listener- Parameters:
value- the value on which to runlistener- the listener- Returns:
- this builder instance
-
when
Adds a conditional consumer- Parameters:
value- the value to consumeconsumer- the consumer- Returns:
- this builder instance
-
when
Adds a conditional listener- Parameters:
predicate- the predicate on which to runlistener- the runnable- Returns:
- this builder instance
-
when
Adds a conditional consumer- Parameters:
predicate- the predicate on which to consume the valueconsumer- the consumer to use- Returns:
- this builder instance
-
build
- Returns:
- an
Observerbased on this builder
-