use of org.apache.uima.cas.impl.CASImpl in project webanno by webanno.
the class RemoteApiController2 method forceSetFeatureValue.
private static void forceSetFeatureValue(FeatureStructure aFS, String aFeatureName, String aValue) {
CASImpl casImpl = (CASImpl) aFS.getCAS().getLowLevelCAS();
TypeSystemImpl ts = (TypeSystemImpl) aFS.getCAS().getTypeSystem();
Feature feat = aFS.getType().getFeatureByBaseName(aFeatureName);
int featCode = ((FeatureImpl) feat).getCode();
int thisType = ((TypeImpl) aFS.getType()).getCode();
if (!ts.isApprop(thisType, featCode)) {
throw new IllegalArgumentException("Feature structure does not have that feature");
}
if (!ts.subsumes(ts.getType(CAS.TYPE_NAME_STRING), feat.getRange())) {
throw new IllegalArgumentException("Not a string feature!");
}
casImpl.ll_setStringValue(casImpl.ll_getFSRef(aFS), featCode, aValue);
}
Aggregations