private <T> void addType(Class<?> clazz, Map<String, TypeCreator<T>> implementations, DynamicCdiTag tag, TypeCreator<T> typeCreator) { String tagValue = tag != null ? tag.value() : "-"; logger.debug("Found implementation: {} (tag={})", typeCreator.toString(), tagValue); if (implementations.containsKey(tagValue)) { throw new JuRuntimeException(String.format( "Found two Simulatable implementations for %s and tag=%s: %s and %s (more might exist)", clazz.getName(), tagValue, implementations.get(tagValue).toString(), typeCreator.toString())); } else { implementations.put(tagValue, typeCreator); } }
@Produces @ScopeControl public TestObject createWithScopeControl() { return this.createTestObject("scopeControl"); }
final Method factoryMethod = method; this.addType(clazz , implementations , method.getAnnotation(DynamicCdiTag.class) final T type = (T)simulatable; this.addType(clazz , implementations , type.getClass().getAnnotation(DynamicCdiTag.class) return implementations.get(tagName).createType(); } else if (implementations.containsKey(defaultTagName)) { logger.debug("Returning default instance: {}", implementations.get(defaultTagName)); return implementations.get(defaultTagName).createType(); } else { throw new JuRuntimeException(String.format("No dynamic implementation found for %s and tagName=%s or defaultTagName=%s",
final Method factoryMethod = method; this.addType(clazz , implementations , method.getAnnotation(DynamicCdiTag.class) final T type = (T)simulatable; this.addType(clazz , implementations , type.getClass().getAnnotation(DynamicCdiTag.class) return implementations.get(tagName).createType(); } else if (implementations.containsKey(defaultTagName)) { logger.debug("Returning default instance: {}", implementations.get(defaultTagName)); return implementations.get(defaultTagName).createType(); } else { throw new JuRuntimeException(String.format("No dynamic implementation found for %s and tagName=%s or defaultTagName=%s",
@Produces @ScopeControl public TestObject createWithScopeControl() { return this.createTestObject("scopeControl"); }
private <T> void addType(Class<?> clazz, Map<String, TypeCreator<T>> implementations, DynamicCdiTag tag, TypeCreator<T> typeCreator) { String tagValue = tag != null ? tag.value() : "-"; logger.debug("Found implementation: {} (tag={})", typeCreator.toString(), tagValue); if (implementations.containsKey(tagValue)) { throw new JuRuntimeException(String.format( "Found two Simulatable implementations for %s and tag=%s: %s and %s (more might exist)", clazz.getName(), tagValue, implementations.get(tagValue).toString(), typeCreator.toString())); } else { implementations.put(tagValue, typeCreator); } }
@Named("namedScope") @Produces @ScopeControl public TestObject createNamedWithScopeControl() { return this.createTestObject("namedWithScopeControl"); }
@Named("namedScope") @Produces @ScopeControl public TestObject createNamedWithScopeControl() { return this.createTestObject("namedWithScopeControl"); }