T - the type of product produced by this Bazaarpublic class BazaarImpl<T> extends Object implements Bazaar<T>
Bazaar using the IEclipseContext for dependency injection.Bazaar.Builder<T>, Bazaar.PriorityOverlapCallBack<T>| Constructor and Description |
|---|
BazaarImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addContextFunction(String key,
BazaarContextFunction contextFunction)
Adds a
BazaarContextFunction to this Bazaar to exchange existing parameters to a parameter
requested by a Vendor. |
org.eclipse.e4.core.contexts.IEclipseContext |
addContextFunctions(org.eclipse.e4.core.contexts.IEclipseContext context)
Transforms all
BazaarContextFunctions to IContextFunctions and attaches those to an
IEclipseContext. |
void |
addVendor(Vendor<? extends T> vendor)
Adds a
Vendor to the bazaar. |
boolean |
checkPreConditions(Vendor<? extends T> vendor,
org.eclipse.e4.core.contexts.IEclipseContext context)
Checks the
Preconditions for a given vendor. |
org.eclipse.e4.core.contexts.IEclipseContext |
createEclipseContext(BazaarContext bazaarContext)
Creates an
IEclipseContext from a BazaarContext. |
T |
createProduct(BazaarContext bazaarContext)
Creates a product of type T, provided by the
Vendor with the highest Bid and which is statisfied
by the parameters in the BazaarContext. |
T |
createProduct(Vendor<? extends T> vendor,
org.eclipse.e4.core.contexts.IEclipseContext context)
Returns the product which is provided with the highest priority by any
Vendor. |
List<T> |
createProducts(BazaarContext bazaarContext)
Creates a list of products of type T, provided by
Vendors which are statisfied by the parameters in the
BazaarContext, ordered by their Bid. |
Vendor<? extends T> |
getBestVendor(org.eclipse.e4.core.contexts.IEclipseContext context) |
void |
removeVendor(Vendor<? extends T> vendor)
Removes a
Vendor from the bazaar. |
void |
setPriorityOverlapCallBack(Bazaar.PriorityOverlapCallBack<? super T> priorityOverlapCallBack)
|
public void addVendor(Vendor<? extends T> vendor)
BazaarVendor to the bazaar. Will be queried if a product is requested, the best fitting will create the
product. Has no effect if the vendor is already present in this bazaar.public void removeVendor(Vendor<? extends T> vendor)
BazaarVendor from the bazaar. Has no effect if the vendor is not present in this bazaar.removeVendor in interface Bazaar<T>vendor - the Vendor to removepublic T createProduct(Vendor<? extends T> vendor, org.eclipse.e4.core.contexts.IEclipseContext context)
Vendor.public org.eclipse.e4.core.contexts.IEclipseContext addContextFunctions(org.eclipse.e4.core.contexts.IEclipseContext context)
BazaarContextFunctions to IContextFunctions and attaches those to an
IEclipseContext.context - the IEclipseContext to attache IContextFunctions toIEclipseContext with attached IContextFunctionpublic org.eclipse.e4.core.contexts.IEclipseContext createEclipseContext(BazaarContext bazaarContext)
IEclipseContext from a BazaarContext.bazaarContext - the BazaarContext to get key / values fromIEclipseContext containign all key / values provided by the BazaarContextpublic Vendor<? extends T> getBestVendor(org.eclipse.e4.core.contexts.IEclipseContext context)
context - the Eclipse injection contextcontextpublic void setPriorityOverlapCallBack(Bazaar.PriorityOverlapCallBack<? super T> priorityOverlapCallBack)
BazaarsetPriorityOverlapCallBack in interface Bazaar<T>priorityOverlapCallBack - a PriorityOverlapCallBackpublic void addContextFunction(String key, BazaarContextFunction contextFunction)
BazaarBazaarContextFunction to this Bazaar to exchange existing parameters to a parameter
requested by a Vendor.addContextFunction in interface Bazaar<T>key - contextFunction - public T createProduct(BazaarContext bazaarContext)
BazaarVendor with the highest Bid and which is statisfied
by the parameters in the BazaarContext. In case of tied bids, the Bazaar.PriorityOverlapCallBack
if one is set will be notified of which vendor is chosen to break the tie. Note that during the
bidding process, ties may have to be broken in this way that are later defeated by a higher bid.createProduct in interface Bazaar<T>bazaarContext - the BazaarContext, which is used to provide requested parameters for VendorVendorBazaar.createProduct(org.eclipse.emfforms.bazaar.BazaarContext)public List<T> createProducts(BazaarContext bazaarContext)
BazaarVendors which are statisfied by the parameters in the
BazaarContext, ordered by their Bid. Ties are not broken as all bids are successful
and are used only for ordering.createProducts in interface Bazaar<T>bazaarContext - the BazaarContext, which is used to provide requested parameters for VendorBidBazaar.createProducts(org.eclipse.emfforms.bazaar.BazaarContext)public boolean checkPreConditions(Vendor<? extends T> vendor, org.eclipse.e4.core.contexts.IEclipseContext context)
Preconditions for a given vendor.vendor - The Vendor to check the Precondition for.context - The IEclipseContext to provide the PreconditionPreconditions are fulfilledCopyright © 2018. All rights reserved.