protected String toStringPrefix() { return this.getClass().getSimpleName() + "[storageId=" + this.getStorageId() + ",fieldType=" + this.getFieldType() + (this.enumType != null ? ",enumType=" + this.enumType : ""); }
@Override public int hashCode() { return super.hashCode() ^ this.parentStorageId; } }
@Override public String toString() { return this.toStringPrefix() + "]"; }
/** * Determine whether the specified field is a reference field. */ boolean isReferenceField(int storageId) { final IndexInfo info = this.indexInfoMap.get(storageId); return info instanceof SimpleFieldIndexInfo && ((SimpleFieldIndexInfo)info).getFieldType() instanceof ReferenceFieldType; }
/** * Read this index. */ @SuppressWarnings({ "unchecked", "rawtypes" }) public Object toIndex(JTransaction jtx) { return new ConvertedIndex(jtx.tx.queryIndex(this.storageId), this.getConverter(jtx), jtx.referenceConverter); }
return ((SimpleFieldIndexInfo)indexInfo).toIndex(this);
private void gatherForwardCascadeRefs(ObjId id, String cascadeName, ObjIdSet visitedIds, ObjIdSet toVisitIds) { final JClass<?> jclass = this.jdb.jclasses.get(id.getStorageId()); if (jclass == null) return; final List<JReferenceField> fieldList = jclass.forwardCascadeMap.get(cascadeName); if (fieldList == null) return; for (JReferenceField field : fieldList) { final SimpleFieldIndexInfo info = (SimpleFieldIndexInfo)this.jdb.indexInfoMap.get(field.storageId); assert info.getFieldType() instanceof ReferenceFieldType; if (info instanceof ComplexSubFieldIndexInfo) { final ComplexSubFieldIndexInfo subFieldInfo = (ComplexSubFieldIndexInfo)info; this.gatherRefs(subFieldInfo.iterateReferences(this.tx, id).iterator(), visitedIds, toVisitIds); } else { final ObjId referrent = (ObjId)this.tx.readSimpleField(id, field.storageId, false); if (referrent != null && visitedIds.add(referrent)) toVisitIds.add(referrent); } } }
/** * Get the index on a simple field. The simple field may be a sub-field of a complex field. * * @param targetType Java type containing the indexed field; may also be any super-type (e.g., an interface type), * as long as {@code fieldName} is not ambiguous among all sub-types * @param fieldName name of the indexed field; for complex fields, * must include the sub-field name (e.g., {@code "mylist.element"}, {@code "mymap.key"}) * @param valueType the Java type corresponding to the field value * @param <V> Java type corresponding to the indexed field * @param <T> Java type containing the field * @return read-only, real-time view of field values mapped to sets of objects having that value in the field * @throws IllegalArgumentException if any parameter is null, or invalid * @throws StaleTransactionException if this transaction is no longer usable */ @SuppressWarnings({ "rawtypes", "unchecked" }) public <V, T> Index<V, T> queryIndex(Class<T> targetType, String fieldName, Class<V> valueType) { final IndexQueryInfo info = this.jdb.getIndexQueryInfo(new IndexQueryInfoKey(fieldName, false, targetType, valueType)); assert info.indexInfo instanceof SimpleFieldIndexInfo; // otherwise getIndexQueryInfo() would have failed... final SimpleFieldIndexInfo indexInfo = (SimpleFieldIndexInfo)info.indexInfo; final CoreIndex<?, ObjId> index = info.applyFilters(this.tx.queryIndex(indexInfo.storageId)); final Converter<?, ?> valueConverter = indexInfo.getConverter(this).reverse(); final Converter<T, ObjId> targetConverter = new ReferenceConverter<T>(this, targetType); return new ConvertedIndex(index, valueConverter, targetConverter); }
this.wrapRaw(path.getTargetFieldTypes()), fieldIndexInfo.getFieldType()));
@Override protected String toStringPrefix() { return super.toStringPrefix() + ",parentStorageId=" + this.getParentStorageId(); }
assert info == null || info.getFieldType() instanceof ReferenceFieldType; if (info instanceof ComplexSubFieldIndexInfo) { final ComplexSubFieldIndexInfo subFieldInfo = (ComplexSubFieldIndexInfo)info;