I find it very convenient to add @TypeCapability(inputs = { TOKEN, SENTENCE, COOCCURRENCE }) so that I can ensure that dependencies are met. But sometimes, the dependencies are dynamic (e.g. an input type capability is part of the config of an annotator, and is loaded dynamically, see code below).
Is there a way to dynamically set a required annotation type from within a UIMAfit annotator? Something like: @Override public void initialize(UimaContext context) throws ResourceInitializationException { super.initialize(context); try { // loading annotation class dynamically requiredAnnotation= (Class<? extends Annotation>) Class.forName( "org.uima.MyRequiredAnnotation"); // adding it as TypeCapability's input context.getMetadata().addCapabilityInput(requiredAnnotation); } catch (Exception e) { throw new ResourceInitializationException(e); } } Thanks, Renaud