org.picocontainer.MutablePicoContainer Java Examples
The following examples show how to use
org.picocontainer.MutablePicoContainer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringFormatComponent.java From spring-javaformat with Apache License 2.0 | 6 votes |
private void registerCodeStyleManager(CodeStyleManager manager) { if (ApplicationInfo.getInstance().getBuild().getBaselineVersion() >= 193) { IdeaPluginDescriptor plugin = PluginManagerCore.getPlugin(PluginId.getId("spring-javaformat")); try { ((ComponentManagerImpl) this.project).registerServiceInstance(CodeStyleManager.class, manager, plugin); } catch (NoSuchMethodError ex) { Method method = findRegisterServiceInstanceMethod(this.project.getClass()); invokeRegisterServiceInstanceMethod(manager, plugin, method); } } else { MutablePicoContainer container = (MutablePicoContainer) this.project.getPicoContainer(); container.unregisterComponent(CODE_STYLE_MANAGER_KEY); container.registerComponentInstance(CODE_STYLE_MANAGER_KEY, manager); } }
Example #2
Source File: BlazeTestCase.java From intellij with Apache License 2.0 | 6 votes |
@Before public final void setup() { testDisposable = new RootDisposable(); TestUtils.createMockApplication(testDisposable); MutablePicoContainer applicationContainer = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer(); MockProject mockProject = TestUtils.mockProject(applicationContainer, testDisposable); extensionsArea = (ExtensionsAreaImpl) Extensions.getRootArea(); this.project = mockProject; initTest( new Container((MockComponentManager) ApplicationManager.getApplication(), testDisposable), new Container(mockProject, testDisposable)); }
Example #3
Source File: ServiceHelper.java From intellij with Apache License 2.0 | 6 votes |
public static <T> void registerApplicationComponent( Class<T> key, T implementation, Disposable parentDisposable) { Application application = ApplicationManager.getApplication(); // #api193 (or #api201?): ComponentManagerImpl moved in 2020.1 dot releases. Check // ComponentManagerImpl directly when earlier releases are no longer supported boolean isComponentManagerImpl = !(application instanceof MockApplication); if (isComponentManagerImpl) { ServiceContainerUtil.registerComponentInstance( application, key, implementation, parentDisposable); } else { registerComponentInstance( (MutablePicoContainer) application.getPicoContainer(), key, implementation, parentDisposable); } }
Example #4
Source File: ServiceHelper.java From intellij with Apache License 2.0 | 6 votes |
private static <T> void registerComponentInstance( MutablePicoContainer container, Class<T> key, T implementation, Disposable parentDisposable) { Object old; try { old = container.getComponentInstance(key); } catch (UnsatisfiableDependenciesException e) { old = null; } container.unregisterComponent(key.getName()); container.registerComponentInstance(key.getName(), implementation); Object finalOld = old; Disposer.register( parentDisposable, () -> { container.unregisterComponent(key.getName()); if (finalOld != null) { container.registerComponentInstance(key.getName(), finalOld); } }); }
Example #5
Source File: ServiceHelper.java From intellij with Apache License 2.0 | 6 votes |
private static <T> void registerService( ComponentManager componentManager, Class<T> key, T implementation, Disposable parentDisposable) { boolean exists = componentManager.getService(key) != null; if (exists) { // upstream code can do it all for us ServiceContainerUtil.replaceService(componentManager, key, implementation, parentDisposable); return; } // otherwise we should manually unregister on disposal ServiceContainerUtil.registerServiceInstance(componentManager, key, implementation); Disposer.register( parentDisposable, () -> ((MutablePicoContainer) componentManager.getPicoContainer()) .unregisterComponent(key.getName())); }
Example #6
Source File: GMLConfiguration.java From GeoTriples with Apache License 2.0 | 6 votes |
/** * Configures the gml3 context. * <p> * The following factories are registered: * <ul> * <li>{@link CoordinateArraySequenceFactory} under {@link CoordinateSequenceFactory} * <li>{@link GeometryFactory} * </ul> * </p> */ public void configureContext(MutablePicoContainer container) { super.configureContext(container); container.registerComponentInstance(new FeatureTypeCache()); container.registerComponentInstance(new XSDIdRegistry()); //factories container.registerComponentInstance(CoordinateSequenceFactory.class, CoordinateArraySequenceFactory.instance()); container.registerComponentImplementation(GeometryFactory.class); container.registerComponentInstance(new GML3EncodingUtils()); if (isExtendedArcSurfaceSupport()) { container.registerComponentInstance(new ArcParameters()); } container.registerComponentInstance(srsSyntax); }
Example #7
Source File: IntellijRule.java From intellij with Apache License 2.0 | 6 votes |
private static <T> void registerComponentInstance( MutablePicoContainer container, Class<T> key, T implementation, Disposable parentDisposable) { Object old; try { old = container.getComponentInstance(key); } catch (UnsatisfiableDependenciesException e) { old = null; } container.unregisterComponent(key.getName()); container.registerComponentInstance(key.getName(), implementation); Object finalOld = old; Disposer.register( parentDisposable, () -> { container.unregisterComponent(key.getName()); if (finalOld != null) { container.registerComponentInstance(key.getName(), finalOld); } }); }
Example #8
Source File: DummyExecutorService.java From jetbrains-plugin-graph-database-support with Apache License 2.0 | 5 votes |
public static void register() { LightPlatformTestCase.initApplication(); MutablePicoContainer container = (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer(); container.unregisterComponent(ExecutorService.class.getName()); container.registerComponentInstance(ExecutorService.class.getName(), new DummyExecutorService()); }
Example #9
Source File: App.java From androidtestdebug with MIT License | 5 votes |
private static MutablePicoContainer 初始化容器() { MutablePicoContainer pico = new DefaultPicoContainer(); pico.addComponent(IocBookStore.class); pico.addComponent(BookReader.class); return pico; }
Example #10
Source File: App.java From androidtestdebug with MIT License | 5 votes |
private static void 使用容器的方式(String author) throws DataInitException { MutablePicoContainer 容器 = 初始化容器(); _store = 容器.getComponent(IStore.class); _store.init(); authorBy(author); }
Example #11
Source File: ServiceHelper.java From intellij with Apache License 2.0 | 5 votes |
public static <T> void registerProjectComponent( Project project, Class<T> key, T implementation, Disposable parentDisposable) { // #api193 (or #api201?): ComponentManagerImpl moved in 2020.1 dot releases. Check // ComponentManagerImpl directly when earlier releases are no longer supported boolean isComponentManagerImpl = project instanceof ProjectImpl; if (isComponentManagerImpl) { ServiceContainerUtil.registerComponentInstance( project, key, implementation, parentDisposable); } else { registerComponentInstance( (MutablePicoContainer) project.getPicoContainer(), key, implementation, parentDisposable); } }
Example #12
Source File: IntellijRule.java From intellij with Apache License 2.0 | 5 votes |
public <T> void registerApplicationComponent(Class<T> klass, T instance) { registerComponentInstance( (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer(), klass, instance, testDisposable); }
Example #13
Source File: IntellijRule.java From intellij with Apache License 2.0 | 5 votes |
public <T> void registerApplicationService(Class<T> klass, T instance) { registerComponentInstance( (MutablePicoContainer) ApplicationManager.getApplication().getPicoContainer(), klass, instance, testDisposable); }
Example #14
Source File: DiffAppendersModule.java From javers with Apache License 2.0 | 4 votes |
public DiffAppendersModule(JaversCoreConfiguration javersCoreConfiguration, MutablePicoContainer container) { super(javersCoreConfiguration, container); this.listChangeAppender = javersCoreConfiguration.getListCompareAlgorithm().getAppenderClass(); }
Example #15
Source File: GraphFactoryModule.java From javers with Apache License 2.0 | 4 votes |
public GraphFactoryModule(MutablePicoContainer container) { super(container); }
Example #16
Source File: TailoredJaversMemberFactoryModule.java From javers with Apache License 2.0 | 4 votes |
public TailoredJaversMemberFactoryModule(JaversCoreConfiguration configuration, MutablePicoContainer container) { super(configuration, container); }
Example #17
Source File: AbstractContainerBuilder.java From javers with Apache License 2.0 | 4 votes |
protected MutablePicoContainer getContainer() { return container; }
Example #18
Source File: AddOnsModule.java From javers with Apache License 2.0 | 4 votes |
public AddOnsModule(MutablePicoContainer container, Collection<Class> implementations) { super(container); this.implementations = new HashSet<>(implementations); }
Example #19
Source File: LateInstantiatingModule.java From javers with Apache License 2.0 | 4 votes |
public LateInstantiatingModule(JaversCoreConfiguration configuration, MutablePicoContainer container) { super(container); this.configuration = configuration; }
Example #20
Source File: InstantiatingModule.java From javers with Apache License 2.0 | 4 votes |
public InstantiatingModule(MutablePicoContainer container) { this.container = container; this.argumentResolver = new ContainerArgumentResolver(container); }
Example #21
Source File: SnapshotModule.java From javers with Apache License 2.0 | 4 votes |
public SnapshotModule(MutablePicoContainer container) { super(container); }
Example #22
Source File: CoreJaversModule.java From javers with Apache License 2.0 | 4 votes |
public CoreJaversModule(MutablePicoContainer container) { super(container); }
Example #23
Source File: IntellijRule.java From intellij with Apache License 2.0 | 4 votes |
public <T> void registerProjectComponent(Class<T> klass, T instance) { registerComponentInstance( (MutablePicoContainer) getProject().getPicoContainer(), klass, instance, testDisposable); }
Example #24
Source File: ChangeTypeAdaptersModule.java From javers with Apache License 2.0 | 4 votes |
public ChangeTypeAdaptersModule(MutablePicoContainer container) { super(container); }
Example #25
Source File: CommitTypeAdaptersModule.java From javers with Apache License 2.0 | 4 votes |
public CommitTypeAdaptersModule(MutablePicoContainer container) { super(container); }
Example #26
Source File: CommitFactoryModule.java From javers with Apache License 2.0 | 4 votes |
public CommitFactoryModule(MutablePicoContainer container) { super(container); }
Example #27
Source File: TypeMapperModule.java From javers with Apache License 2.0 | 4 votes |
public TypeMapperModule(MutablePicoContainer container) { super(container); }
Example #28
Source File: ScannerModule.java From javers with Apache License 2.0 | 4 votes |
public ScannerModule(JaversCoreConfiguration configuration, MutablePicoContainer container) { super(configuration, container); }
Example #29
Source File: ShadowModule.java From javers with Apache License 2.0 | 4 votes |
public ShadowModule(MutablePicoContainer container) { super(container); }
Example #30
Source File: JqlModule.java From javers with Apache License 2.0 | 4 votes |
public JqlModule(MutablePicoContainer container) { super(container); }