private static CompositeIndexInfo findCompositeIndex(Permazen jdb, Class<?> startType, String indexName, int numValues) { CompositeIndexInfo indexInfo = null; for (JClass<?> jclass : jdb.getJClasses(startType)) { final JCompositeIndex index = jclass.jcompositeIndexesByName.get(indexName); if (index != null) { final CompositeIndexInfo candidate = jdb.getIndexInfo(index.storageId, CompositeIndexInfo.class); if (indexInfo != null && !candidate.equals(indexInfo)) { throw new IllegalArgumentException("ambiguous composite index name `" + indexName + "': multiple incompatible composite indexes with that name exist on sub-types of " + startType.getName()); } indexInfo = candidate; } } if (indexInfo == null) { throw new IllegalArgumentException("no composite index named `" + indexName + "' exists on any sub-type of " + startType.getName()); } if (numValues != indexInfo.getFieldTypes().size()) { throw new IllegalArgumentException("composite index `" + indexName + "' on " + startType.getName() + " has " + indexInfo.getFieldTypes().size() + " fields, not " + numValues); } return indexInfo; }
final SimpleFieldIndexInfo fieldIndexInfo = jdb.getIndexInfo(path.targetFieldStorageId, keyType != null ? MapValueIndexInfo.class : SimpleFieldIndexInfo.class); this.indexInfo = fieldIndexInfo;