List of usage examples for com.google.common.collect ImmutableClassToInstanceMap copyOf
public static <B, S extends B> ImmutableClassToInstanceMap<B> copyOf( Map<? extends Class<? extends S>, ? extends S> map)
From source file:com.facebook.presto.connector.StaticConnector.java
public StaticConnector(Map<Class<?>, ?> services) { this.services = ImmutableClassToInstanceMap.copyOf(services); }
From source file:com.facebook.presto.hive.PrestoHadoopConfiguration.java
public PrestoHadoopConfiguration(ClassToInstanceMap<?> services) { super(false); this.services = ImmutableClassToInstanceMap.copyOf(requireNonNull(services, "services is null")); }
From source file:com.cloudata.structured.sql.provider.CloudataConnector.java
public CloudataConnector(StructuredStore store, Map<Class<?>, ?> services) { this.store = store; this.services = ImmutableClassToInstanceMap.copyOf(services); }
From source file:see.evaluation.evaluators.SimpleContext.java
private SimpleContext(Scope scope, ClassToInstanceMap<Object> services) { this.scope = scope; this.services = ImmutableClassToInstanceMap.copyOf(services); }
From source file:org.opendaylight.mdsal.dom.spi.SimpleDOMMountPoint.java
private SimpleDOMMountPoint(final YangInstanceIdentifier identifier, final ClassToInstanceMap<DOMService> services, final SchemaContext ctx) { this.identifier = identifier; this.services = ImmutableClassToInstanceMap.copyOf(services); this.schemaContext = ctx; }
From source file:org.opendaylight.mdsal.binding.testutils.AugmentableExtension.java
public ClassToInstanceMap<Augmentation<?>> getAugmentations(Augmentable<?> augmentable) { if (augmentable instanceof AugmentationReader) { AugmentationReader augmentationReader = (AugmentationReader) augmentable; return ImmutableClassToInstanceMap.copyOf(augmentationReader.getAugmentations(augmentable)); } else if (Proxy.isProxyClass(augmentable.getClass())) { InvocationHandler invocationHandler = Proxy.getInvocationHandler(augmentable); // class LazyDataObject implements InvocationHandler, AugmentationReader AugmentationReader augmentationReader = (AugmentationReader) invocationHandler; return ImmutableClassToInstanceMap.copyOf(augmentationReader.getAugmentations(augmentable)); } else {//from w ww. j av a 2s. c o m try { return ImmutableClassToInstanceMap.copyOf(REFLECT_EXTENSIONS.get(augmentable, "augmentation")); } catch (ClassCastException | SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { throw new IllegalArgumentException("TODO Implement getAugmentations() for an Augmentable which " + "is neither a (Proxy of an) AugmentationReader nor has an internal field named " + "'augmentation': " + augmentable.getClass(), e); } } }
From source file:com.opengamma.strata.basics.market.ImmutableTypedReferenceData.java
/** * Obtains an instance from a map of values keyed by type. * <p>// w w w . ja va 2 s . c om * Each value must be an instance of the type it is keyed by. * * @param values the reference data values * @return typed reference data containing the values * @throws ClassCastException if a value is not an instance of the type it is keyed by */ public static ImmutableTypedReferenceData of(Map<Class<?>, ?> values) { // use ClassToInstanceMap to validate, but avoid using that type in bean property ImmutableClassToInstanceMap<Object> validated = ImmutableClassToInstanceMap.copyOf(values); return new ImmutableTypedReferenceData(validated); }
From source file:org.richfaces.services.ServicesFactoryImpl.java
public void init(Iterable<Module> modules) { instances = MutableClassToInstanceMap.create(); for (Module module : modules) { module.configure(this); }/* w ww .j a v a 2s . c om*/ for (Object service : instances.values()) { if (service instanceof Initializable) { Initializable initializableService = (Initializable) service; initializableService.init(); } } instances = ImmutableClassToInstanceMap.copyOf(instances); }
From source file:org.richfaces.application.ServicesFactoryImpl.java
/** * Allows to configure and initialize a set of modules *//*from w ww . j a v a 2 s. co m*/ public void init(Iterable<Module> modules) { instances = MutableClassToInstanceMap.create(); for (Module module : modules) { module.configure(this); } for (Object service : instances.values()) { if (service instanceof Initializable) { Initializable initializableService = (Initializable) service; initializableService.init(); } } instances = ImmutableClassToInstanceMap.copyOf(instances); }
From source file:neon.client.ComponentManager.java
/** * /*from w ww . j av a 2 s .co m*/ * @param uid * @return all components of the given entity */ public ClassToInstanceMap<Component> getComponents(long uid) { return ImmutableClassToInstanceMap.copyOf(components.rowMap().get(uid)); }