public static String getAnnotationProperty(IdentifiedAnnotation annotation,
                                               CTAKESAnnotationProperty property) {
        String value = null;
        if (property == CTAKESAnnotationProperty.BEGIN) {
            value = Integer.toString(annotation.getBegin());
        } else if (property == CTAKESAnnotationProperty.END) {
            value = Integer.toString(annotation.getEnd());
        } else if (property == CTAKESAnnotationProperty.CONDITIONAL) {
            value = Boolean.toString(annotation.getConditional());
        } else if (property == CTAKESAnnotationProperty.CONFIDENCE) {
            value = Float.toString(annotation.getConfidence());
        } else if (property == CTAKESAnnotationProperty.DISCOVERY_TECNIQUE) {
            value = Integer.toString(annotation.getDiscoveryTechnique());
        } else if (property == CTAKESAnnotationProperty.GENERIC) {
            value = Boolean.toString(annotation.getGeneric());
        } else if (property == CTAKESAnnotationProperty.HISTORY_OF) {
            value = Integer.toString(annotation.getHistoryOf());
        } else if (property == CTAKESAnnotationProperty.ID) {
            value = Integer.toString(annotation.getId());
        } else if (property == CTAKESAnnotationProperty.ONTOLOGY_CONCEPT_ARR) {
            FSArray mentions = annotation.getOntologyConceptArr();
            StringBuilder sb = new StringBuilder();
            if (mentions != null) {
                for (int i = 0; i < mentions.size(); i++) {
                    if (mentions.get(i) instanceof UmlsConcept) {
                        UmlsConcept concept = (UmlsConcept) mentions.get(i);
                        sb.append("cui=").append(concept.getCui()).append(",").
                                append(concept.getCodingScheme()).append("=").
                                append(concept.getCode());
                        if (i < mentions.size() - 1) {
                            sb.append(",");
                        }
                    }
                }
            }
            value = sb.toString();
        } else if (property == CTAKESAnnotationProperty.POLARITY) {
            String polarity_pref = "POLARITY";
            value = new StringBuilder(polarity_pref).append("=").
                    append(Integer.toString(annotation.getPolarity())).toString();
        }
        return value;
    }
Returns the annotation value based on the given annotation type.

@param annotation {@link IdentifiedAnnotation} object.
@param property   {@link CTAKESAnnotationProperty} enum used to identify the
                  annotation type.
@return the annotation value.
tika-parsers/tika-parsers-ml/tika-parser-nlp-module/src/main/java/org/apache/tika/parser/ctakes/CTAKESUtils.java