public String getObjectType() { if(objectType != null) return objectType; return dataAccess.getSchema().getName(); }
@Override public HollowTypeReadState getTypeState() { return currentDataAccess.getTypeState(); }
public HollowDataAccess getDataAccess() { return typeDataAccess.getDataAccess(); }
@Override public void ignoreUpdateThreadForSampling(Thread t) { currentDataAccess.ignoreUpdateThreadForSampling(t); }
public void setFieldSpecificSamplingDirector(HollowFilterConfig fieldSpec, HollowSamplingDirector director) { typeDataAccess.setFieldSpecificSamplingDirector(fieldSpec, director); }
@Override public void setSamplingDirector(HollowSamplingDirector director) { currentDataAccess.setSamplingDirector(director); }
@Override public HollowSampler getSampler() { return currentDataAccess.getSampler(); }
public void ignoreUpdateThreadForSampling(Thread t) { typeDataAccess.ignoreUpdateThreadForSampling(t); }
@Override public void setFieldSpecificSamplingDirector(HollowFilterConfig fieldSpec, HollowSamplingDirector director) { currentDataAccess.setFieldSpecificSamplingDirector(fieldSpec, director); }
public void setSamplingDirector(HollowSamplingDirector samplingDirector) { typeDataAccess.setSamplingDirector(samplingDirector); }
public Collection<SampleResult> getAccessSampleResults() { return typeDataAccess.getSampler().getSampleResults(); }
public HollowObjectCacheProvider(HollowTypeDataAccess typeDataAccess, HollowTypeAPI typeAPI, HollowFactory<T> factory, HollowObjectCacheProvider<T> previous) { if(typeDataAccess != null) { PopulatedOrdinalListener listener = typeDataAccess.getTypeState().getListener(PopulatedOrdinalListener.class); BitSet populatedOrdinals = listener.getPopulatedOrdinals(); BitSet previousOrdinals = listener.getPreviousOrdinals(); int length = Math.max(populatedOrdinals.length(), previousOrdinals.length()); List<T> arr = new ArrayList<T>(length); for(int ordinal = 0; ordinal < length; ordinal++) { while(ordinal >= arr.size()) arr.add(null); if(previous != null && previousOrdinals.get(ordinal) && populatedOrdinals.get(ordinal)) { T cached = previous.getHollowObject(ordinal); arr.set(ordinal, cached); if(cached instanceof HollowRecord) ((HollowCachedDelegate)((HollowRecord)cached).getDelegate()).updateTypeAPI(typeAPI); } else if(populatedOrdinals.get(ordinal)){ arr.set(ordinal, instantiateCachedObject(factory, typeDataAccess, typeAPI, ordinal)); } } if(typeDataAccess instanceof HollowTypeReadState) { this.factory = factory; this.typeAPI = typeAPI; this.typeReadState = (HollowTypeReadState)typeDataAccess; this.typeReadState.addListener(this); } this.cachedItems = arr; } else { this.cachedItems = Collections.emptyList(); } }
@Override public HollowSchema getSchema(String name) { return getTypeDataAccess(name).getSchema(); }
@Override public String stringify(HollowRecord record) { return stringify(record.getTypeDataAccess().getDataAccess(), record.getSchema().getName(), record.getOrdinal()); }
@Override public GenericHollowObject getRecord(int ordinal) { HollowObjectTypeReadState typeState = (HollowObjectTypeReadState) rStateEngine.getTypeDataAccess(type).getTypeState(); GenericHollowObject obj = new GenericHollowObject(new HollowObjectGenericDelegate(typeState), ordinal); return obj; } }
@Override public HollowSchema getSchema() { return dataAccess.getSchema(); }
@Override public void stringify(Writer writer, HollowRecord record) throws IOException { stringify(writer, record.getTypeDataAccess().getDataAccess(), record.getSchema().getName(), record.getOrdinal()); }
protected void computeDataChange(String type, HollowReadStateEngine stateEngine, PrimaryKey primaryKey) { HollowTypeReadState typeState = stateEngine.getTypeDataAccess(type).getTypeState();
private HollowTypeDataAccess getChildDataAccess(HollowTypeDataAccess typeDataAccess, String childName) { if(typeDataAccess instanceof HollowObjectTypeDataAccess) { HollowObjectSchema schema = (HollowObjectSchema) typeDataAccess.getSchema(); int fieldIdx = schema.getPosition(childName); String childType = schema.getReferencedType(fieldIdx); return dataAccess.getTypeDataAccess(childType); } else if(typeDataAccess instanceof HollowCollectionTypeDataAccess) { HollowCollectionSchema schema = (HollowCollectionSchema) typeDataAccess.getSchema(); return dataAccess.getTypeDataAccess(schema.getElementType()); } else if(typeDataAccess instanceof HollowMapTypeDataAccess) { HollowMapSchema schema = (HollowMapSchema) typeDataAccess.getSchema(); String childType = "key".equals(childName) ? schema.getKeyType() : schema.getValueType(); return dataAccess.getTypeDataAccess(childType); } throw new IllegalArgumentException("I can't create a child node for a " + typeDataAccess.getClass()); }
@Override public void stringify(Writer writer, HollowRecord record) throws IOException { stringify(writer, record.getTypeDataAccess().getDataAccess(), record.getSchema().getName(), record.getOrdinal()); }