當前位置: 首頁>>代碼示例>>Java>>正文


Java Injector.getAllBindings方法代碼示例

本文整理匯總了Java中com.google.inject.Injector.getAllBindings方法的典型用法代碼示例。如果您正苦於以下問題:Java Injector.getAllBindings方法的具體用法?Java Injector.getAllBindings怎麽用?Java Injector.getAllBindings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.inject.Injector的用法示例。


在下文中一共展示了Injector.getAllBindings方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: GuiceQueryPluginFactory

import com.google.inject.Injector; //導入方法依賴的package包/類
@Inject
@SuppressWarnings("unchecked")
public GuiceQueryPluginFactory(Injector injector)
{
	m_injector = injector;
	Map<Key<?>, Binding<?>> bindings = injector.getAllBindings();

	for (Key<?> key : bindings.keySet())
	{
		Class<?> bindingClass = key.getTypeLiteral().getRawType();
		if (QueryPlugin.class.isAssignableFrom(bindingClass))
		{
			PluginName ann = (PluginName) bindingClass.getAnnotation(PluginName.class);
			if (ann == null)
				throw new IllegalStateException("Aggregator class " + bindingClass.getName() +
						" does not have required annotation " + PluginName.class.getName());

			m_plugins.put(ann.name(), (Class<QueryPlugin>)bindingClass);
		}
	}
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:22,代碼來源:GuiceQueryPluginFactory.java

示例2: GuiceGroupByFactory

import com.google.inject.Injector; //導入方法依賴的package包/類
@Inject
@SuppressWarnings("unchecked")
public GuiceGroupByFactory(Injector injector)
{
	this.injector = injector;
	Map<Key<?>, Binding<?>> bindings = injector.getAllBindings();

	for (Key<?> key : bindings.keySet())
	{
		Class<?> bindingClass = key.getTypeLiteral().getRawType();
		if (GroupBy.class.isAssignableFrom(bindingClass))
		{
			GroupByName name = (GroupByName)bindingClass.getAnnotation(GroupByName.class);
			if (name == null)
				throw new IllegalStateException("Aggregator class "+bindingClass.getName()+
						" does not have required annotation "+GroupByName.class.getName());

			groupBys.put(name.name(), (Class<GroupBy>)bindingClass);
		}
	}
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:22,代碼來源:GuiceGroupByFactory.java

示例3: HealthCheckServiceImpl

import com.google.inject.Injector; //導入方法依賴的package包/類
@Inject
public HealthCheckServiceImpl(Injector injector)
{
	checkNotNull(injector);

	Map<Key<?>, Binding<?>> bindings = injector.getAllBindings();

	for (Key<?> key : bindings.keySet())
	{
		Class<?> bindingClass = key.getTypeLiteral().getRawType();
		if (HealthStatus.class.isAssignableFrom(bindingClass))
		{
			checks.add((HealthStatus) injector.getInstance(bindingClass));
		}
	}
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:17,代碼來源:HealthCheckServiceImpl.java

示例4: DataPointListenerProvider

import com.google.inject.Injector; //導入方法依賴的package包/類
@Inject
public DataPointListenerProvider(Injector injector)
{
	Map<Key<?>, Binding<?>> bindings = injector.getAllBindings();

	for (Key<?> key : bindings.keySet())
	{
		Class<?> bindingClass = key.getTypeLiteral().getRawType();
		if (DataPointListener.class.isAssignableFrom(bindingClass))
		{
			DataPointListener listener = (DataPointListener)injector.getInstance(bindingClass);
			m_listeners.add(listener);
		}
	}
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:16,代碼來源:DataPointListenerProvider.java

示例5: GuiceCommandProvider

import com.google.inject.Injector; //導入方法依賴的package包/類
@Inject
public GuiceCommandProvider(Injector injector)
{
	Map<Key<?>, Binding<?>> bindings = injector.getAllBindings();

	for (Key<?> key : bindings.keySet())
	{
		Class<?> bindingClass = key.getTypeLiteral().getRawType();
		if (TelnetCommand.class.isAssignableFrom(bindingClass))
		{
			TelnetCommand command = (TelnetCommand)injector.getInstance(bindingClass);
			m_commandMap.put(command.getCommand(), command);
		}
	}
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:16,代碼來源:GuiceCommandProvider.java

示例6: GuiceAggregatorFactory

import com.google.inject.Injector; //導入方法依賴的package包/類
@Inject
@SuppressWarnings("unchecked")
public GuiceAggregatorFactory(Injector injector)
{
	m_injector = injector;
	Map<Key<?>, Binding<?>> bindings = injector.getAllBindings();

       for (Key<?> key : bindings.keySet())
	{
		Class<?> bindingClass = key.getTypeLiteral().getRawType();
		if (Aggregator.class.isAssignableFrom(bindingClass))
		{
			AggregatorName ann = bindingClass.getAnnotation(AggregatorName.class);
			if (ann == null)
				throw new IllegalStateException("Aggregator class " + bindingClass.getName()+
						" does not have required annotation " + AggregatorName.class.getName());

			m_aggregators.put(ann.name(), (Class<Aggregator>)bindingClass);

               ImmutableList<AggregatorPropertyMetadata> properties = getAggregatorPropertyMetadata(ann);
               m_aggregatorsMetadata.add(new AggregatorMetadata(ann.name(), ann.description(), properties));
		}
	}
	Collections.sort(m_aggregatorsMetadata, new Comparator<AggregatorMetadata>()
	{
		@Override
		public int compare(AggregatorMetadata o1, AggregatorMetadata o2)
		{
			return o1.getName().compareTo(o2.getName());
		}
	});
}
 
開發者ID:quqiangsheng,項目名稱:abhot,代碼行數:33,代碼來源:GuiceAggregatorFactory.java


注:本文中的com.google.inject.Injector.getAllBindings方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。