}
anFsIndexList.add(anFsIndex);
}
FsIndexCollection_impl fsIndexCollection = new FsIndexCollection_impl();
// Process collected FsIndex annotations
for (FsIndex anIdx : anFsIndexList) {
// Collect index keys
List<FsIndexKeyDescription> keys = new ArrayList<FsIndexKeyDescription>();
for (FsIndexKey anIndexKey : anIdx.keys()) {
keys.add(createFsIndexKeyDescription(anIndexKey.featureName(), anIndexKey.comparator()));
}
// type and typeName must not be set at the same time
if (!anIdx.typeName().equals(FsIndex.NO_NAME_TYPE_SET)
&& anIdx.type() != FsIndex.NoClassSet.class) {
throw new IllegalStateException("Class [" + componentClass.getName() + "] must not "
+ "declare an " + org.apache.uima.fit.descriptor.FsIndex.class.getSimpleName()
+ " with type and typeName both set at the same time.");
}
String typeName;
if (!anIdx.typeName().equals(FsIndex.NO_NAME_TYPE_SET)) {
typeName = anIdx.typeName();
} else if (anIdx.type() != FsIndex.NoClassSet.class) {
typeName = anIdx.type().getName();
} else {
throw new IllegalStateException("Class [" + componentClass.getName() + "] must not "
+ "declare an " + org.apache.uima.fit.descriptor.FsIndex.class.getSimpleName()
+ " with neither type nor typeName set.");
}
fsIndexCollection.addFsIndex(createFsIndexDescription(anIdx.label(), anIdx.kind(), typeName,
anIdx.typePriorities(), keys.toArray(new FsIndexKeyDescription[keys.size()])));
}
return fsIndexCollection;
}