@Test public void testString() { Entity e = new Entity(jCas); e.setValue("Test Value"); e.addToIndexes(); Feature f = e.getType().getFeatureByBaseName("value"); Object o = FeatureUtils.featureToObject(f, e); assertTrue(o instanceof String); assertEquals("Test Value", (String) o); }
public static Object featureToObject(Feature f, Annotation a) { Object ret = null; switch (f.getRange().getName()) { case CAS.TYPE_NAME_STRING: ret = StringToObject.convertStringToObject(a.getStringValue(f)); break; case CAS.TYPE_NAME_INTEGER: ret = a.getIntValue(f); break; case CAS.TYPE_NAME_FLOAT: ret = a.getFloatValue(f); break; case CAS.TYPE_NAME_BOOLEAN: ret = a.getBooleanValue(f); break; case CAS.TYPE_NAME_BYTE: ret = a.getByteValue(f); break; case CAS.TYPE_NAME_SHORT: ret = a.getShortValue(f); break; case CAS.TYPE_NAME_LONG: ret = a.getLongValue(f); break; case CAS.TYPE_NAME_DOUBLE: ret = a.getDoubleValue(f); break; default: ret = null; } return ret; }
FeatureUtils { public static Object featureToObject(Feature f, Annotation a) { Object ret = null; switch (f.getRange().getName()) { case CAS.TYPE_NAME_STRING: ret = StringToObject.convertStringToObject(a.getStringValue(f)); break; case CAS.TYPE_NAME_INTEGER: ret = a.getIntValue(f); break; case CAS.TYPE_NAME_FLOAT: ret = a.getFloatValue(f); break; case CAS.TYPE_NAME_BOOLEAN: ret = a.getBooleanValue(f); break; case CAS.TYPE_NAME_BYTE: ret = a.getByteValue(f); break; case CAS.TYPE_NAME_SHORT: ret = a.getShortValue(f); break; case CAS.TYPE_NAME_LONG: ret = a.getLongValue(f); break; case CAS.TYPE_NAME_DOUBLE: ret = a.getDoubleValue(f); break; default: ret = null; } return ret; } }
FeatureUtils { public static Object featureToObject(Feature f, Annotation a) { Object ret = null; switch (f.getRange().getName()) { case CAS.TYPE_NAME_STRING: ret = StringToObject.convertStringToObject(a.getStringValue(f)); break; case CAS.TYPE_NAME_INTEGER: ret = a.getIntValue(f); break; case CAS.TYPE_NAME_FLOAT: ret = a.getFloatValue(f); break; case CAS.TYPE_NAME_BOOLEAN: ret = a.getBooleanValue(f); break; case CAS.TYPE_NAME_BYTE: ret = a.getByteValue(f); break; case CAS.TYPE_NAME_SHORT: ret = a.getShortValue(f); break; case CAS.TYPE_NAME_LONG: ret = a.getLongValue(f); break; case CAS.TYPE_NAME_DOUBLE: ret = a.getDoubleValue(f); break; default: ret = null; } return ret; } private  FeatureUtils(); }
FeatureUtils { public static Object featureToObject(Feature f, Annotation a) { Object ret = null; switch (f.getRange().getName()) { case CAS.TYPE_NAME_STRING: ret = StringToObject.convertStringToObject(a.getStringValue(f)); break; case CAS.TYPE_NAME_INTEGER: ret = a.getIntValue(f); break; case CAS.TYPE_NAME_FLOAT: ret = a.getFloatValue(f); break; case CAS.TYPE_NAME_BOOLEAN: ret = a.getBooleanValue(f); break; case CAS.TYPE_NAME_BYTE: ret = a.getByteValue(f); break; case CAS.TYPE_NAME_SHORT: ret = a.getShortValue(f); break; case CAS.TYPE_NAME_LONG: ret = a.getLongValue(f); break; case CAS.TYPE_NAME_DOUBLE: ret = a.getDoubleValue(f); break; default: ret = null; } return ret; } private  FeatureUtils(); static Object featureToObject(Feature f, Annotation a); static Object[] featureToArray(Feature f, Annotation a); static List<Object> featureToList(Feature f, Annotation a); }
FeatureUtils { public static Object featureToObject(Feature f, Annotation a) { Object ret = null; switch (f.getRange().getName()) { case CAS.TYPE_NAME_STRING: ret = StringToObject.convertStringToObject(a.getStringValue(f)); break; case CAS.TYPE_NAME_INTEGER: ret = a.getIntValue(f); break; case CAS.TYPE_NAME_FLOAT: ret = a.getFloatValue(f); break; case CAS.TYPE_NAME_BOOLEAN: ret = a.getBooleanValue(f); break; case CAS.TYPE_NAME_BYTE: ret = a.getByteValue(f); break; case CAS.TYPE_NAME_SHORT: ret = a.getShortValue(f); break; case CAS.TYPE_NAME_LONG: ret = a.getLongValue(f); break; case CAS.TYPE_NAME_DOUBLE: ret = a.getDoubleValue(f); break; default: ret = null; } return ret; } private  FeatureUtils(); static Object featureToObject(Feature f, Annotation a); static Object[] featureToArray(Feature f, Annotation a); static List<Object> featureToList(Feature f, Annotation a);  }