JCoReFeaturePath implements FeaturePath { @Override public String getValueAsString(FeatureStructure fs) { return getValueAsString(fs, false); }  static Map<String, String> readReplacementsFromFile(String replacementsFile); static Map<String, String> readReplacementsFromInputStream(InputStream is); @Override int size(); @Override Feature getFeature(int i); @Override void addFeature(Feature feat); @Override void initialize(String featurePath); void initialize(String featurePath, Map<?, ?> replacements); @Override void typeInit(Type featurePathType); Object replaceValue(FeatureStructure fs); Object getValue(FeatureStructure fs, int startFeatureIndex); String[] getValueAsStringArray(FeatureStructure fs, boolean doReplacements); String[] getValueAsStringArray(FeatureStructure fs); List<String> getValueAsStringList(FeatureStructure fs, boolean doReplacements); List<String> getValueAsStringList(FeatureStructure fs); @Override String getValueAsString(FeatureStructure fs); String getValueAsString(FeatureStructure fs, boolean doReplacements); boolean getReplaceUnmappedValues(); void setReplaceUnmappedValues(boolean replaceWithNullValues); @Override String ll_getValueAsString(int fsRef, LowLevelCAS llCas); @Override Type getType(FeatureStructure fs); @Override TypeClass getTypClass(FeatureStructure fs); @Override String getFeaturePath(); @Override String getStringValue(FeatureStructure fs); @Override Integer getIntValue(FeatureStructure fs); @Override Boolean getBooleanValue(FeatureStructure fs); @Override Byte getByteValue(FeatureStructure fs); @Override Double getDoubleValue(FeatureStructure fs); @Override Float getFloatValue(FeatureStructure fs); @Override Long getLongValue(FeatureStructure fs); @Override Short getShortValue(FeatureStructure fs); @Override FeatureStructure getFSValue(FeatureStructure fs); void loadReplacementsFromFile(String replacementsFile); Object getDefaultReplacementValue(); void setDefaultReplacementValue(Object defaultReplacementValue); void clearReplacementCache();  }
@Test public void testGetValueAsString() throws Exception { JCas jcas = JCasFactory.createJCas("de.julielab.jcore.types.jcore-all-types"); JCoReFeaturePath fp = new JCoReFeaturePath(); fp.initialize("/resourceEntryList[0]/entryId"); Gene gene = new Gene(jcas); ResourceEntry resourceEntry = new ResourceEntry(jcas); resourceEntry.setEntryId("EntryId1"); FSArray resourceEntryArray = new FSArray(jcas, 1); resourceEntryArray.set(0, resourceEntry); gene.setResourceEntryList(resourceEntryArray); assertEquals(resourceEntry.getEntryId(), fp.getValueAsString(gene)); Token token = new Token(jcas); Lemma lemma = new Lemma(jcas); lemma.setValue("lemmaValue"); token.setLemma(lemma); JCoReFeaturePath fp2 = new JCoReFeaturePath(); fp2.initialize("/lemma/value"); assertEquals(lemma.getValue(), fp2.getValueAsString(token)); }