@Test public void testStringArray() { Buzzword bw = new Buzzword(jCas); StringArray tags = new StringArray(jCas, 2); tags.set(0, "tag1"); tags.set(1, "tag2"); bw.setTags(tags); bw.addToIndexes(); Feature f = bw.getType().getFeatureByBaseName("tags"); StringArray newTags = new StringArray(jCas, 2); newTags.set(0, "first"); newTags.set(1, "second"); NewFeatureUtils.setPrimitiveArray(jCas, bw, f, Arrays.asList(newTags.toArray())); assertEquals("first", bw.getTags(0)); assertEquals("second", bw.getTags(1)); }
public static void setPrimitiveArray( final JCas jCas, final BaleenAnnotation annotation, final Feature feature, final Object value) { final Type componentType = feature.getRange().getComponentType(); Collection<?> list; if (value instanceof Collection) { list = (Collection<?>) value; } else { list = Collections.singletonList(value); } CommonArrayFS fs = getCommonArrayFS(jCas, componentType, list); if (fs != null) { annotation.setFeatureValue(feature, fs); } }
NewFeatureUtils { public static void setPrimitiveArray( final JCas jCas, final BaleenAnnotation annotation, final Feature feature, final Object value) { final Type componentType = feature.getRange().getComponentType(); Collection<?> list; if (value instanceof Collection) { list = (Collection<?>) value; } else { list = Collections.singletonList(value); } CommonArrayFS fs = getCommonArrayFS(jCas, componentType, list); if (fs != null) { annotation.setFeatureValue(feature, fs); } } }
NewFeatureUtils { public static void setPrimitiveArray( final JCas jCas, final BaleenAnnotation annotation, final Feature feature, final Object value) { final Type componentType = feature.getRange().getComponentType(); Collection<?> list; if (value instanceof Collection) { list = (Collection<?>) value; } else { list = Collections.singletonList(value); } CommonArrayFS fs = getCommonArrayFS(jCas, componentType, list); if (fs != null) { annotation.setFeatureValue(feature, fs); } } private  NewFeatureUtils(); }
NewFeatureUtils { public static void setPrimitiveArray( final JCas jCas, final BaleenAnnotation annotation, final Feature feature, final Object value) { final Type componentType = feature.getRange().getComponentType(); Collection<?> list; if (value instanceof Collection) { list = (Collection<?>) value; } else { list = Collections.singletonList(value); } CommonArrayFS fs = getCommonArrayFS(jCas, componentType, list); if (fs != null) { annotation.setFeatureValue(feature, fs); } } private  NewFeatureUtils(); static void setPrimitive(
      final BaleenAnnotation annotation, final Feature feature, final Object value); static void setPrimitiveArray(
      final JCas jCas,
      final BaleenAnnotation annotation,
      final Feature feature,
      final Object value); }
NewFeatureUtils { public static void setPrimitiveArray( final JCas jCas, final BaleenAnnotation annotation, final Feature feature, final Object value) { final Type componentType = feature.getRange().getComponentType(); Collection<?> list; if (value instanceof Collection) { list = (Collection<?>) value; } else { list = Collections.singletonList(value); } CommonArrayFS fs = getCommonArrayFS(jCas, componentType, list); if (fs != null) { annotation.setFeatureValue(feature, fs); } } private  NewFeatureUtils(); static void setPrimitive(
      final BaleenAnnotation annotation, final Feature feature, final Object value); static void setPrimitiveArray(
      final JCas jCas,
      final BaleenAnnotation annotation,
      final Feature feature,
      final Object value);  }