Permalink
Browse files

Expose PrimaryKey and FieldTypes

1 parent 51a5cf6 commit 0e86263f003123a5dfe397803bb33714c7d8f42a dsu committed Jan 5, 2017
Showing with 11 additions and 0 deletions.
  1. +11 −0 hollow/src/main/java/com/netflix/hollow/core/index/HollowPrimaryKeyIndex.java
@@ -33,6 +33,7 @@
import com.netflix.hollow.core.read.engine.PopulatedOrdinalListener;
import com.netflix.hollow.core.read.engine.object.HollowObjectTypeReadState;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.BitSet;
import java.util.Collection;
import java.util.Collections;
@@ -51,6 +52,7 @@
private final HollowObjectTypeReadState typeState;
private final int[][] fieldPathIndexes;
private final FieldType[] fieldTypes;
+ private final PrimaryKey primaryKey;
private final HollowPrimaryKeyValueDeriver keyDeriver;
private final ArraySegmentRecycler memoryRecycler;
@@ -82,6 +84,7 @@ public HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine, PrimaryKey prima
public HollowPrimaryKeyIndex(HollowReadStateEngine stateEngine, PrimaryKey primaryKey, ArraySegmentRecycler memoryRecycler, BitSet specificOrdinalsToIndex) {
if (primaryKey==null) throw new IllegalArgumentException("primaryKey can't not be null");
+ this.primaryKey = primaryKey;
this.typeState = (HollowObjectTypeReadState) stateEngine.getTypeState(primaryKey.getType());
this.fieldPathIndexes = new int[primaryKey.numFields()][];
this.fieldTypes = new FieldType[primaryKey.numFields()];
@@ -139,6 +142,14 @@ public HollowObjectTypeReadState getTypeState() {
return typeState;
}
+ public PrimaryKey getPrimaryKey() {
+ return primaryKey;
+ }
+
+ public List<FieldType> getFieldTypes() {
+ return Arrays.asList(fieldTypes);
+ }
+
/**
* Query an index with a single specified field. The returned value with be the ordinal of the matching record.
* <p>

0 comments on commit 0e86263

Please sign in to comment.