@Test public void testAutoDetectIndexes() throws Exception { org.apache.uima.resource.metadata.FsIndexCollection fsIndexCollection = createFsIndexCollection(); FsIndexDescription index1 = fsIndexCollection.getFsIndexes()[0]; assertEquals("Automatically Scanned Index", index1.getLabel()); assertEquals(Token.class.getName(), index1.getTypeName()); assertEquals(FsIndexDescription.KIND_SORTED, index1.getKind()); }
public static FsIndexCollection createFsIndexCollection(Class<?> componentClass) { List<FsIndex> anFsIndexList = new ArrayList<>(); org.apache.uima.fit.descriptor.FsIndexCollection anIndexCollection = getInheritableAnnotation( org.apache.uima.fit.descriptor.FsIndexCollection.class, componentClass); if (anIndexCollection != null) { anFsIndexList.addAll(asList(anIndexCollection.fsIndexes())); } org.apache.uima.fit.descriptor.FsIndex anFsIndex = getInheritableAnnotation(FsIndex.class, componentClass); if (anFsIndex != null) { if (anIndexCollection != null) { throw new IllegalStateException( "Class [" + componentClass.getName() + "] must not " + "declare " + org.apache.uima.fit.descriptor.FsIndexCollection.class.getSimpleName() + " and " + FsIndex.class.getSimpleName() + " at the same time."); } anFsIndexList.add(anFsIndex); } FsIndexCollection_impl fsIndexCollection = new FsIndexCollection_impl(); for (FsIndex anIdx : anFsIndexList) { List<FsIndexKeyDescription> keys = new ArrayList<>(); for (FsIndexKey anIndexKey : anIdx.keys()) { keys.add(createFsIndexKeyDescription(anIndexKey.featureName(), anIndexKey.comparator())); } 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; }
FsIndexFactory { public static FsIndexCollection createFsIndexCollection(Class<?> componentClass) { List<FsIndex> anFsIndexList = new ArrayList<>(); org.apache.uima.fit.descriptor.FsIndexCollection anIndexCollection = getInheritableAnnotation( org.apache.uima.fit.descriptor.FsIndexCollection.class, componentClass); if (anIndexCollection != null) { anFsIndexList.addAll(asList(anIndexCollection.fsIndexes())); } org.apache.uima.fit.descriptor.FsIndex anFsIndex = getInheritableAnnotation(FsIndex.class, componentClass); if (anFsIndex != null) { if (anIndexCollection != null) { throw new IllegalStateException( "Class [" + componentClass.getName() + "] must not " + "declare " + org.apache.uima.fit.descriptor.FsIndexCollection.class.getSimpleName() + " and " + FsIndex.class.getSimpleName() + " at the same time."); } anFsIndexList.add(anFsIndex); } FsIndexCollection_impl fsIndexCollection = new FsIndexCollection_impl(); for (FsIndex anIdx : anFsIndexList) { List<FsIndexKeyDescription> keys = new ArrayList<>(); for (FsIndexKey anIndexKey : anIdx.keys()) { keys.add(createFsIndexKeyDescription(anIndexKey.featureName(), anIndexKey.comparator())); } 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; } }
FsIndexFactory { public static FsIndexCollection createFsIndexCollection(Class<?> componentClass) { List<FsIndex> anFsIndexList = new ArrayList<>(); org.apache.uima.fit.descriptor.FsIndexCollection anIndexCollection = getInheritableAnnotation( org.apache.uima.fit.descriptor.FsIndexCollection.class, componentClass); if (anIndexCollection != null) { anFsIndexList.addAll(asList(anIndexCollection.fsIndexes())); } org.apache.uima.fit.descriptor.FsIndex anFsIndex = getInheritableAnnotation(FsIndex.class, componentClass); if (anFsIndex != null) { if (anIndexCollection != null) { throw new IllegalStateException( "Class [" + componentClass.getName() + "] must not " + "declare " + org.apache.uima.fit.descriptor.FsIndexCollection.class.getSimpleName() + " and " + FsIndex.class.getSimpleName() + " at the same time."); } anFsIndexList.add(anFsIndex); } FsIndexCollection_impl fsIndexCollection = new FsIndexCollection_impl(); for (FsIndex anIdx : anFsIndexList) { List<FsIndexKeyDescription> keys = new ArrayList<>(); for (FsIndexKey anIndexKey : anIdx.keys()) { keys.add(createFsIndexKeyDescription(anIndexKey.featureName(), anIndexKey.comparator())); } 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; } private  FsIndexFactory(); }
FsIndexFactory { public static FsIndexCollection createFsIndexCollection(Class<?> componentClass) { List<FsIndex> anFsIndexList = new ArrayList<>(); org.apache.uima.fit.descriptor.FsIndexCollection anIndexCollection = getInheritableAnnotation( org.apache.uima.fit.descriptor.FsIndexCollection.class, componentClass); if (anIndexCollection != null) { anFsIndexList.addAll(asList(anIndexCollection.fsIndexes())); } org.apache.uima.fit.descriptor.FsIndex anFsIndex = getInheritableAnnotation(FsIndex.class, componentClass); if (anFsIndex != null) { if (anIndexCollection != null) { throw new IllegalStateException( "Class [" + componentClass.getName() + "] must not " + "declare " + org.apache.uima.fit.descriptor.FsIndexCollection.class.getSimpleName() + " and " + FsIndex.class.getSimpleName() + " at the same time."); } anFsIndexList.add(anFsIndex); } FsIndexCollection_impl fsIndexCollection = new FsIndexCollection_impl(); for (FsIndex anIdx : anFsIndexList) { List<FsIndexKeyDescription> keys = new ArrayList<>(); for (FsIndexKey anIndexKey : anIdx.keys()) { keys.add(createFsIndexKeyDescription(anIndexKey.featureName(), anIndexKey.comparator())); } 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; } private  FsIndexFactory(); static FsIndexCollection createFsIndexCollection(Class<?> componentClass); static FsIndexDescription createFsIndexDescription(String label, String kind,
          String typeName, boolean useTypePriorities, FsIndexKeyDescription... keys); static FsIndexCollection createFsIndexCollection(FsIndexDescription... descriptions); static FsIndexKeyDescription createFsIndexKeyDescription(String featureName); static FsIndexKeyDescription createFsIndexKeyDescription(String featureName,
          int comparator); static FsIndexCollection createFsIndexCollection(String... descriptorNames); static FsIndexCollection createTypeSystemDescriptionFromPath(String... descriptorURIs); static FsIndexCollection createFsIndexCollection(); static String[] scanIndexDescriptors(); static void forceIndexDescriptorsScan(); }
FsIndexFactory { public static FsIndexCollection createFsIndexCollection(Class<?> componentClass) { List<FsIndex> anFsIndexList = new ArrayList<>(); org.apache.uima.fit.descriptor.FsIndexCollection anIndexCollection = getInheritableAnnotation( org.apache.uima.fit.descriptor.FsIndexCollection.class, componentClass); if (anIndexCollection != null) { anFsIndexList.addAll(asList(anIndexCollection.fsIndexes())); } org.apache.uima.fit.descriptor.FsIndex anFsIndex = getInheritableAnnotation(FsIndex.class, componentClass); if (anFsIndex != null) { if (anIndexCollection != null) { throw new IllegalStateException( "Class [" + componentClass.getName() + "] must not " + "declare " + org.apache.uima.fit.descriptor.FsIndexCollection.class.getSimpleName() + " and " + FsIndex.class.getSimpleName() + " at the same time."); } anFsIndexList.add(anFsIndex); } FsIndexCollection_impl fsIndexCollection = new FsIndexCollection_impl(); for (FsIndex anIdx : anFsIndexList) { List<FsIndexKeyDescription> keys = new ArrayList<>(); for (FsIndexKey anIndexKey : anIdx.keys()) { keys.add(createFsIndexKeyDescription(anIndexKey.featureName(), anIndexKey.comparator())); } 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; } private  FsIndexFactory(); static FsIndexCollection createFsIndexCollection(Class<?> componentClass); static FsIndexDescription createFsIndexDescription(String label, String kind,
          String typeName, boolean useTypePriorities, FsIndexKeyDescription... keys); static FsIndexCollection createFsIndexCollection(FsIndexDescription... descriptions); static FsIndexKeyDescription createFsIndexKeyDescription(String featureName); static FsIndexKeyDescription createFsIndexKeyDescription(String featureName,
          int comparator); static FsIndexCollection createFsIndexCollection(String... descriptorNames); static FsIndexCollection createTypeSystemDescriptionFromPath(String... descriptorURIs); static FsIndexCollection createFsIndexCollection(); static String[] scanIndexDescriptors(); static void forceIndexDescriptorsScan(); static final int STANDARD_COMPARE; static final int REVERSE_STANDARD_COMPARE; }