本文整理汇总了Java中se.jbee.inject.Injector类的典型用法代码示例。如果您正苦于以下问题:Java Injector类的具体用法?Java Injector怎么用?Java Injector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Injector类属于se.jbee.inject包,在下文中一共展示了Injector类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: supply
import se.jbee.inject.Injector; //导入依赖的package包/类
@Override
public java.util.function.Supplier<?> supply( Dependency<? super java.util.function.Supplier<?>> dependency, Injector injector ) {
Dependency<?> providedType = dependency.onTypeParameter();
if ( !dependency.getName().isDefault() ) {
providedType = providedType.named( dependency.getName() );
}
final Dependency<?> finalProvidedType = providedType;
return () -> SuppliedBy.lazyProvider(finalProvidedType.uninject().ignoredExpiry(), injector).provide();
}
示例2: supply
import se.jbee.inject.Injector; //导入依赖的package包/类
@Override
public Logger supply(Dependency<? super Logger> dependency, Injector injector) {
if (dependency.isUntargeted() || isForGame(dependency)) {
return LoggerFactory.getLogger(getDefaultName());
} else {
return StreamSupport.stream(dependency.spliterator(), false)
.map(target -> target.getTarget().getInstance().getType().getRawType())
.filter(clazz -> clazz.isAnnotationPresent(Mod.class))
.findFirst()
.map(clazz -> clazz.getAnnotation(Mod.class))
.map(mod -> LoggerFactory.getLogger(String.format("%s (%s)", mod.id(), mod.name())))
.orElseGet(() -> LoggerFactory.getLogger(dependency.iterator().next().getTarget().getInstance().getType().getRawType()));
}
}
示例3: supply
import se.jbee.inject.Injector; //导入依赖的package包/类
@Override
public Optional<?> supply(Dependency<? super Optional<?>> dependency,
Injector injector) {
try {
return Optional.of(injector.resolve(Dependency.dependency(dependency.getType().getParameters()[0])));
} catch (Throwable t) {
return Optional.empty();
}
}
示例4: injector
import se.jbee.inject.Injector; //导入依赖的package包/类
public static Injector injector() {
return injector;
}
示例5: getInjector
import se.jbee.inject.Injector; //导入依赖的package包/类
/**
* @return current injector instance.
*/
public Optional<Injector> getInjector() {
return injector;
}
示例6: supply
import se.jbee.inject.Injector; //导入依赖的package包/类
@Override
public GameInfo supply(Dependency<? super GameInfo> dependency, Injector injector) {
return new GameInfo("test", "1.0.0");
}
示例7: supply
import se.jbee.inject.Injector; //导入依赖的package包/类
@Override
public UpdateTicker.SynchronizedTicker supply(Dependency<? super UpdateTicker.SynchronizedTicker> dependency, Injector injector) {
return new FakeSyncTicker();
}
示例8: supply
import se.jbee.inject.Injector; //导入依赖的package包/类
@Override
public UpdateTicker.SynchronizedTicker supply(Dependency<? super UpdateTicker.SynchronizedTicker> dependency, Injector injector) {
return synchronizedTicker;
}
示例9: supply
import se.jbee.inject.Injector; //导入依赖的package包/类
@Override
public GameInfo supply(Dependency<? super GameInfo> dependency, Injector injector) {
return minecraft;
}