Search in sources :

Example 1 with ServiceProviderDictionary

use of org.platformlayer.xaas.services.ServiceProviderDictionary in project platformlayer by platformlayer.

the class ServiceProviderHelpers method getModelClass.

public ModelClass<?> getModelClass(PlatformLayerKey platformLayerKey) {
    OpsContext ops = OpsContext.get();
    ServiceProviderDictionary serviceProviderDictionary = ops.getInjector().getInstance(ServiceProviderDictionary.class);
    ServiceType serviceType = platformLayerKey.getServiceType();
    ItemType itemType = platformLayerKey.getItemType();
    ServiceProvider serviceProvider = serviceProviderDictionary.getServiceProvider(serviceType);
    if (serviceProvider == null) {
        throw new IllegalArgumentException();
    }
    ModelClass<?> modelClass = serviceProvider.getModelClass(itemType);
    if (modelClass == null) {
        throw new IllegalArgumentException();
    }
    return modelClass;
}
Also used : ServiceType(org.platformlayer.ids.ServiceType) ItemType(org.platformlayer.ids.ItemType) ServiceProvider(org.platformlayer.xaas.services.ServiceProvider) ServiceProviderDictionary(org.platformlayer.xaas.services.ServiceProviderDictionary) OpsContext(org.platformlayer.ops.OpsContext)

Aggregations

ItemType (org.platformlayer.ids.ItemType)1 ServiceType (org.platformlayer.ids.ServiceType)1 OpsContext (org.platformlayer.ops.OpsContext)1 ServiceProvider (org.platformlayer.xaas.services.ServiceProvider)1 ServiceProviderDictionary (org.platformlayer.xaas.services.ServiceProviderDictionary)1