Package org.eclipse.emfforms.bazaar
Class Bazaar.Builder<T>
- java.lang.Object
-
- org.eclipse.emfforms.bazaar.Bazaar.Builder<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Bazaar.Builder<T>add(Vendor<? extends T> vendor)Adds a vendor.Bazaar.Builder<T>add(Vendor<? extends T> vendor1, Vendor<? extends T> vendor2, Vendor<? extends T>... more)Adds vendors.Bazaar.Builder<T>addAll(java.util.Collection<? extends Vendor<? extends T>> vendors)Adds vendors.Bazaar.Builder<T>addContextFunction(java.lang.Class<?> type, BazaarContextFunction contextFunction)Add a context function.Bazaar.Builder<T>addContextFunction(java.lang.String key, BazaarContextFunction contextFunction)Add a context function.Bazaar<T>build()Create the bazaar.static <T> Bazaar.Builder<T>empty()Creates a new empty bazaar builder.Bazaar.Builder<T>onPriorityOverlap(Bazaar.PriorityOverlapCallBack<? super T> overlapHandler)Set the handler for priority overlaps.Bazaar.Builder<T>threadSafe()Request that the bazaar be thread-safe.static <T> Bazaar.Builder<T>with(java.util.Collection<? extends Vendor<? extends T>> vendors)Creates a new bazaar builder with the given initialvendors.
-
-
-
Method Detail
-
empty
public static <T> Bazaar.Builder<T> empty()
Creates a new empty bazaar builder.- Type Parameters:
T- the type of product provided by theBazaar- Returns:
- an initially empty builder
-
with
public static <T> Bazaar.Builder<T> with(java.util.Collection<? extends Vendor<? extends T>> vendors)
Creates a new bazaar builder with the given initialvendors.- Type Parameters:
T- the type of product provided by theBazaar- Parameters:
vendors- initial vendors- Returns:
- an initialized builder
-
add
public Bazaar.Builder<T> add(Vendor<? extends T> vendor)
Adds a vendor.- Parameters:
vendor- the vendor to add- Returns:
- this builder
-
add
public Bazaar.Builder<T> add(Vendor<? extends T> vendor1, Vendor<? extends T> vendor2, Vendor<? extends T>... more)
Adds vendors.- Parameters:
vendor1- a vendor to addvendor2- another vendor to addmore- optional additional vendors to add- Returns:
- this builder
-
addAll
public Bazaar.Builder<T> addAll(java.util.Collection<? extends Vendor<? extends T>> vendors)
Adds vendors.- Parameters:
vendors- vendors to add- Returns:
- this builder
-
addContextFunction
public Bazaar.Builder<T> addContextFunction(java.lang.Class<?> type, BazaarContextFunction contextFunction)
Add a context function.- Parameters:
type- the context value type provided by the functioncontextFunction- the context function to add- Returns:
- this
Bazaar.Builder
-
addContextFunction
public Bazaar.Builder<T> addContextFunction(java.lang.String key, BazaarContextFunction contextFunction)
Add a context function.- Parameters:
key- the context key for the functioncontextFunction- the context function to add- Returns:
- this
Bazaar.Builder
-
onPriorityOverlap
public Bazaar.Builder<T> onPriorityOverlap(Bazaar.PriorityOverlapCallBack<? super T> overlapHandler)
Set the handler for priority overlaps. This may only be set once.- Parameters:
overlapHandler- the overlap handler to set- Returns:
- this builder
-
threadSafe
public Bazaar.Builder<T> threadSafe()
Request that the bazaar be thread-safe. This is useful for bazaars that may be accessed arbitrarily by concurrent threads. By default, the builder creates bazaars that are not thread-safe.- Returns:
- this builder
-
-