@Test public void testGetDefinitionFactory() { assertNull(tested.getDefinitionFactory(DefinitionFactory.class.getName())); tested.register(definitionFactory); assertNull(tested.getDefinitionFactory(NOT_VALID_ID)); assertEquals(definitionFactory, tested.getDefinitionFactory(DefinitionFactory.class.getName())); assertEquals(definitionFactory, tested.getDefinitionFactory(DefinitionFactory.class)); }
@Override public DefinitionFactory<?> getDefinitionFactory(final String id) { for (final DefinitionFactory<?> factory : definitionFactories) { if (factory.accepts(id)) { return factory; } } return null; }
FactoryRegistryImpl implements TypeFactoryRegistry<T> { @Override public DefinitionFactory<?> getDefinitionFactory(final String id) { for (final DefinitionFactory<?> factory : definitionFactories) { if (factory.accepts(id)) { return factory; } } return null; } }
FactoryRegistryImpl implements TypeFactoryRegistry<T> { @Override public DefinitionFactory<?> getDefinitionFactory(final String id) { for (final DefinitionFactory<?> factory : definitionFactories) { if (factory.accepts(id)) { return factory; } } return null; } FactoryRegistryImpl(final AdapterManager adapterManager); }
FactoryRegistryImpl implements TypeFactoryRegistry<T> { @Override public DefinitionFactory<?> getDefinitionFactory(final String id) { for (final DefinitionFactory<?> factory : definitionFactories) { if (factory.accepts(id)) { return factory; } } return null; } FactoryRegistryImpl(final AdapterManager adapterManager); @Override DefinitionFactory<?> getDefinitionFactory(final String id); @Override ElementFactory<?, ?, ?> getElementFactory(final Class<? extends ElementFactory> type); @Override @SuppressWarnings("unchecked") DiagramFactory<?, ?> getDiagramFactory(final String defSetId,
                                                  final Class<? extends Metadata> metadataType); @Override @SuppressWarnings("unchecked") void register(final T item); @Override boolean remove(final T item); @Override void clear(); @Override boolean contains(final T item); @Override boolean isEmpty(); @Override @SuppressWarnings("unchecked") Collection<T> getAllFactories(); @Override DefinitionFactory<?> getDefinitionFactory(final Class<?> type); }
FactoryRegistryImpl implements TypeFactoryRegistry<T> { @Override public DefinitionFactory<?> getDefinitionFactory(final String id) { for (final DefinitionFactory<?> factory : definitionFactories) { if (factory.accepts(id)) { return factory; } } return null; } FactoryRegistryImpl(final AdapterManager adapterManager); @Override DefinitionFactory<?> getDefinitionFactory(final String id); @Override ElementFactory<?, ?, ?> getElementFactory(final Class<? extends ElementFactory> type); @Override @SuppressWarnings("unchecked") DiagramFactory<?, ?> getDiagramFactory(final String defSetId,
                                                  final Class<? extends Metadata> metadataType); @Override @SuppressWarnings("unchecked") void register(final T item); @Override boolean remove(final T item); @Override void clear(); @Override boolean contains(final T item); @Override boolean isEmpty(); @Override @SuppressWarnings("unchecked") Collection<T> getAllFactories(); @Override DefinitionFactory<?> getDefinitionFactory(final Class<?> type);  }