CodeGenerationComponentImpl implements CodeGenerationComponent { @Override @SuppressWarnings("unchecked") public <DOC extends HasName & HasMainInterface, T extends ClassOrInterface<T>> Translator<DOC, T> findTranslator(DOC document, Class<T> modelType, String key) { return translators(document, key::equals) .findAny() .map(translator -> (Translator<DOC, T>) translator) .orElseThrow(noTranslatorFound(document, key)); } CodeGenerationComponentImpl(); @ExecuteBefore(State.INITIALIZED) void setInjector(Injector injector); @Override CodeGenerationComponent newClass(GenerateClass<Project> creator); @Override CodeGenerationComponent newEnum(GenerateEnum<Project> creator); @Override CodeGenerationComponent newInterface(GenerateInterface<Project> creator); @Override TranslatorAppender<Table> forEveryTable(); @Override TranslatorAppender<Schema> forEverySchema(); @Override TranslatorAppender<Dbms> forEveryDbms(); @Override DecoratorBuilder<T> decorate(TranslatorKey<DOC, T> key); @SuppressWarnings("unchecked") @Override void put(Class<DOC> docType, Class<T> modelType, String key, TranslatorConstructor<DOC, T> constructor); @Override void add(Class<DOC> docType, Class<T> modelType, String key, TranslatorDecorator<DOC, T> decorator); @Override void remove(Class<DOC> docType, String key); @Override Stream<? extends Translator<DOC, ?>> translators(DOC document); @Override Stream<String> translatorKeys(); @Override @SuppressWarnings("unchecked") Translator<DOC, T> findTranslator(DOC document, Class<T> modelType, String key);  }
@Test void findTranslator() { }