当前位置: 首页>>代码示例>>Java>>正文


Java Injector.uninject方法代码示例

本文整理汇总了Java中org.jboss.msc.inject.Injector.uninject方法的典型用法代码示例。如果您正苦于以下问题:Java Injector.uninject方法的具体用法?Java Injector.uninject怎么用?Java Injector.uninject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.msc.inject.Injector的用法示例。


在下文中一共展示了Injector.uninject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test_1

import org.jboss.msc.inject.Injector; //导入方法依赖的package包/类
static void test_1(){
	final AtomicReference<String> reference = new AtomicReference<String>();
	final Injector<String> injector = new AtomicReferenceInjector<String>(reference);
	injector.inject("Hello World");
	System.out.println(reference.get());
	injector.uninject();
}
 
开发者ID:jbosschina,项目名称:wildfly-dev-cookbook,代码行数:8,代码来源:TestInject.java

示例2: test_2

import org.jboss.msc.inject.Injector; //导入方法依赖的package包/类
static void test_2() throws NoSuchFieldException, SecurityException {
	final Field field = SimplePojo.class.getField("description");
	final SimplePojo pojo = new SimplePojo();
	final Injector<String> injector = new FieldInjector<String>(Values.immediateValue(pojo), field);
	injector.inject("Injection of description field");
	System.out.println(pojo.description);
	injector.uninject();
}
 
开发者ID:jbosschina,项目名称:wildfly-dev-cookbook,代码行数:9,代码来源:TestInject.java

示例3: test_4

import org.jboss.msc.inject.Injector; //导入方法依赖的package包/类
static void test_4() throws NoSuchMethodException, SecurityException {
	Value<SimplePojo> target = new ImmediateValue<>(new SimplePojo());
	Method method = SimplePojo.class.getMethod("setId", Integer.class);
	final Injector<Integer> injector = SetMethodInjector.<Integer>create(target, method);
	injector.inject(1000);
	System.out.println(target.getValue().getId());
	injector.uninject();
}
 
开发者ID:jbosschina,项目名称:wildfly-dev-cookbook,代码行数:9,代码来源:TestInject.java

示例4: main

import org.jboss.msc.inject.Injector; //导入方法依赖的package包/类
public static void main(String[] args) throws NoSuchFieldException, SecurityException, NoSuchMethodException {

		final Field field = SimplePojo.class.getField("listField");
		List<String> list = new ArrayList<>();
		SimplePojo pojo = new SimplePojo();
		list.add("Hello World");
		final Injector<List> fieldInjector = new FieldInjector<>(Values.immediateValue(pojo), field);
		final Injector<Object> castingInjector = Injectors.cast(fieldInjector, List.class);
		castingInjector.inject(list);
		System.out.println(pojo.listField.get(0));
		castingInjector.uninject();
	}
 
开发者ID:jbosschina,项目名称:wildfly-dev-cookbook,代码行数:13,代码来源:TestInject.java


注:本文中的org.jboss.msc.inject.Injector.uninject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。