@Test public void testValidate() throws Exception{ JCas cas = createCasWithText("token1 token2 token3"); AnnotationTokenStream annotationTokenStream = new AnnotationTokenStream(cas, CAS.NAME_DEFAULT_SOFA, "org.apache.uima.lucas.indexer.types.test.Annotation1"); Type annotation1Type = (Type) cas.getTypeSystem().getType(Annotation1.class.getCanonicalName()); annotationTokenStream.validate(annotation1Type, Lists.newArrayList("featureString"), null); }
void validate(Type type, Collection<String> featureNames, String featurePath) throws InvalidTokenSourceException { Type typeToValidate = findTypeWithPath(type, featurePath); for (String featureName : featureNames) { Feature feature = typeToValidate.getFeatureByBaseName(featureName); if (feature == null) throw new InvalidTokenSourceException("Type " + typeToValidate.getName() + " has no feature " + featureName + ". featurePath: " + featurePath); } }
AnnotationTokenStream extends TokenStream { void validate(Type type, Collection<String> featureNames, String featurePath) throws InvalidTokenSourceException { Type typeToValidate = findTypeWithPath(type, featurePath); for (String featureName : featureNames) { Feature feature = typeToValidate.getFeatureByBaseName(featureName); if (feature == null) throw new InvalidTokenSourceException("Type " + typeToValidate.getName() + " has no feature " + featureName + ". featurePath: " + featurePath); } } }
AnnotationTokenStream extends TokenStream { void validate(Type type, Collection<String> featureNames, String featurePath) throws InvalidTokenSourceException { Type typeToValidate = findTypeWithPath(type, featurePath); for (String featureName : featureNames) { Feature feature = typeToValidate.getFeatureByBaseName(featureName); if (feature == null) throw new InvalidTokenSourceException("Type " + typeToValidate.getName() + " has no feature " + featureName + ". featurePath: " + featurePath); } } AnnotationTokenStream(JCas jCas, String sofaName, String typeName);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			String featureName, Format featureFormat);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			List<String> featureNames, String delimiter,
			Map<String, Format> featureFormats);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			List<String> featureNames, Map<String, Format> featureFormats);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			String featurePath, List<String> featureNames,
			Map<String, Format> featureFormats);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			String featurePath, List<String> featureNames, String delimiter,
			Map<String, Format> featureFormats); }
AnnotationTokenStream extends TokenStream { void validate(Type type, Collection<String> featureNames, String featurePath) throws InvalidTokenSourceException { Type typeToValidate = findTypeWithPath(type, featurePath); for (String featureName : featureNames) { Feature feature = typeToValidate.getFeatureByBaseName(featureName); if (feature == null) throw new InvalidTokenSourceException("Type " + typeToValidate.getName() + " has no feature " + featureName + ". featurePath: " + featurePath); } } AnnotationTokenStream(JCas jCas, String sofaName, String typeName);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			String featureName, Format featureFormat);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			List<String> featureNames, String delimiter,
			Map<String, Format> featureFormats);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			List<String> featureNames, Map<String, Format> featureFormats);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			String featurePath, List<String> featureNames,
			Map<String, Format> featureFormats);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			String featurePath, List<String> featureNames, String delimiter,
			Map<String, Format> featureFormats); @Override Token next(Token token); @Override Token next(); String getValueForFeature(FeatureStructure featureStructure,
			Feature feature, Format format); void reset(); Map<String, Format> getFeatureFormats(); JCas getJCas(); String getFeaturePath(); List<String> getFeatureNames(); String getDelimiter(); Type getAnnotationType(); }
AnnotationTokenStream extends TokenStream { void validate(Type type, Collection<String> featureNames, String featurePath) throws InvalidTokenSourceException { Type typeToValidate = findTypeWithPath(type, featurePath); for (String featureName : featureNames) { Feature feature = typeToValidate.getFeatureByBaseName(featureName); if (feature == null) throw new InvalidTokenSourceException("Type " + typeToValidate.getName() + " has no feature " + featureName + ". featurePath: " + featurePath); } } AnnotationTokenStream(JCas jCas, String sofaName, String typeName);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			String featureName, Format featureFormat);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			List<String> featureNames, String delimiter,
			Map<String, Format> featureFormats);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			List<String> featureNames, Map<String, Format> featureFormats);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			String featurePath, List<String> featureNames,
			Map<String, Format> featureFormats);  AnnotationTokenStream(JCas jCas, String sofaName, String typeName,
			String featurePath, List<String> featureNames, String delimiter,
			Map<String, Format> featureFormats); @Override Token next(Token token); @Override Token next(); String getValueForFeature(FeatureStructure featureStructure,
			Feature feature, Format format); void reset(); Map<String, Format> getFeatureFormats(); JCas getJCas(); String getFeaturePath(); List<String> getFeatureNames(); String getDelimiter(); Type getAnnotationType();  }