Source:
public static void setFeature(FeatureStructure aFS, AnnotationFeature aFeature, Object aValue) { if (aFeature == null) { return; } Feature feature = aFS.getType().getFeatureByBaseName(aFeature.getName()); switch (aFeature.getMultiValueMode()) { case NONE: { if (!Objects.equals(aFeature.getType(), feature.getRange().getName())) { throw new IllegalArgumentException("On [" + aFS.getType().getName() + "] feature [" + aFeature.getName() + "] actual type [" + feature.getRange().getName() + "] does not match expected feature type [" + aFeature.getType() + "]."); } switch (aFeature.getType()) { case CAS.TYPE_NAME_STRING: aFS.setStringValue(feature, (String) aValue); break; case CAS.TYPE_NAME_BOOLEAN: aFS.setBooleanValue(feature, aValue != null && (boolean) aValue); break; case CAS.TYPE_NAME_FLOAT: aFS.setFloatValue(feature, aValue != null ? (float) aValue : 0.0f); break; case CAS.TYPE_NAME_INTEGER: aFS.setIntValue(feature, aValue != null ? (int) aValue : 0); break; default: throw new IllegalArgumentException("Cannot set value of feature [" + aFeature.getName() + "] with type [" + feature.getRange().getName() + "] to [" + aValue + "]"); } break; } case ARRAY: { switch (aFeature.getLinkMode()) { case WITH_ROLE: { setLinkFeature(aFS, aFeature, (List<LinkWithRoleModel>) aValue, feature); break; } default: throw new IllegalArgumentException("Unsupported link mode [" + aFeature.getLinkMode() + "] on feature [" + aFeature.getName() + "]"); } break; } default: throw new IllegalArgumentException("Unsupported multi-value mode [" + aFeature.getMultiValueMode() + "] on feature [" + aFeature.getName() + "]"); } }

Target:
public static void setFeature(FeatureStructure aFS, AnnotationFeature aFeature, Object aValue) { if (aFeature == null) { return; } Feature feature = aFS.getType().getFeatureByBaseName(aFeature.getName()); switch (aFeature.getMultiValueMode()) { case NONE: { if (!Objects.equals(aFeature.getType(), feature.getRange().getName())) { throw new IllegalArgumentException("On [" + aFS.getType().getName() + "] feature [" + aFeature.getName() + "] actual type [" + feature.getRange().getName() + "] does not match expected feature type [" + aFeature.getType() + "]."); } switch (aFeature.getType()) { case CAS.TYPE_NAME_STRING: aFS.setStringValue(feature, (String) aValue); break; case CAS.TYPE_NAME_BOOLEAN: aFS.setBooleanValue(feature, aValue != null ? (boolean) aValue : false); break; case CAS.TYPE_NAME_FLOAT: aFS.setFloatValue(feature, aValue != null ? (float) aValue : 0.0f); break; case CAS.TYPE_NAME_INTEGER: aFS.setIntValue(feature, aValue != null ? (int) aValue : 0); break; default: throw new IllegalArgumentException("Cannot set value of feature [" + aFeature.getName() + "] with type [" + feature.getRange().getName() + "] to [" + aValue + "]"); } break; } case ARRAY: { switch (aFeature.getLinkMode()) { case WITH_ROLE: { setLinkFeature(aFS, aFeature, (List<LinkWithRoleModel>) aValue, feature); break; } default: throw new IllegalArgumentException("Unsupported link mode [" + aFeature.getLinkMode() + "] on feature [" + aFeature.getName() + "]"); } break; } default: throw new IllegalArgumentException("Unsupported multi-value mode [" + aFeature.getMultiValueMode() + "] on feature [" + aFeature.getName() + "]"); } }