@EventListener public void onContextRefreshedEvent(ContextRefreshedEvent aEvent) { init(); }
@Override public LayerSupport getLayerSupport(String aId) { return getLayerSupports().stream().filter(fs -> fs.getId().equals(aId)).findFirst() .orElse(null); }
layerBehaviorRegistry.init(); LayerSupportRegistryImpl layerRegistry = new LayerSupportRegistryImpl(asList( new SpanLayerSupport(featureSupportRegistry, null, schemaService, layerBehaviorRegistry), new ChainLayerSupport(featureSupportRegistry, null, schemaService, layerBehaviorRegistry))); layerRegistry.init(); when(schemaService.getAdapter(any(AnnotationLayer.class))).then(_call -> { AnnotationLayer layer = _call.getArgument(0); return layerRegistry.getLayerSupport(layer).createAdapter(layer); });
layerBehaviorRegistry.init(); layerSupportRegistry = new LayerSupportRegistryImpl(asList( new SpanLayerSupport(featureSupportRegistry, null, annotationSchemaService, layerBehaviorRegistry), new ChainLayerSupport(featureSupportRegistry, null, annotationSchemaService, layerBehaviorRegistry))); layerSupportRegistry.init();
@Bean public LayerSupportRegistry layerSupportRegistry() { return new LayerSupportRegistryImpl(asList( new SpanLayerSupport(featureSupportRegistry(), null, annotationService(), null), new RelationLayerSupport(featureSupportRegistry(), null, annotationService(), null), new ChainLayerSupport(featureSupportRegistry(), null, annotationService(), null))); } }
@Mock TypeAdapter getAdapter(AnnotationLayer aLayer) { return layerSupportRegistry.getLayerSupport(aLayer).createAdapter(aLayer); }
@EventListener public void onContextRefreshedEvent(ContextRefreshedEvent aEvent) { init(); }
@Override public LayerSupport getLayerSupport(String aId) { return getLayerSupports().stream().filter(fs -> fs.getId().equals(aId)).findFirst() .orElse(null); }
@Override public LayerType getLayerType(AnnotationLayer aLayer) { if (aLayer.getType() == null) { return null; } // Figure out which layer support provides the given type. // If we can find a suitable layer support, then use it to resolve the type to a LayerType LayerType featureType = null; for (LayerSupport s : getLayerSupports()) { Optional<LayerType> ft = s.getLayerType(aLayer); if (ft.isPresent()) { featureType = ft.get(); break; } } return featureType; } }
@Override public LayerType getLayerType(AnnotationLayer aLayer) { if (aLayer.getType() == null) { return null; } // Figure out which layer support provides the given type. // If we can find a suitable layer support, then use it to resolve the type to a LayerType LayerType featureType = null; for (LayerSupport s : getLayerSupports()) { Optional<LayerType> ft = s.getLayerType(aLayer); if (ft.isPresent()) { featureType = ft.get(); break; } } return featureType; } }
for (LayerSupport<?> s : getLayerSupports()) { if (s.accepts(aLayer)) { support = s;
for (LayerSupport<?> s : getLayerSupports()) { if (s.accepts(aLayer)) { support = s;