Create An AnnotationService Layer
The annotation behaviours should not modify the JCas
directly. Therefore, the annotation behaviours should use an annotation service instead. In this case, this approach provides the advantage that changes will be done by just one instance and behaviours won't need to know implementation details of JCas
.
@Service
public class AnnotationService {
private JCas jCas;
private final ObservableList<Token> tokens = FXCollections.observableArrayList();
@Bean
public ObservableList<Token> tokensProperty() {
return FXCollections.unmodifiableObservableList(list);
}
public void segmentToken(/* ... */) {
}
// ...
}