Tabnine Logo
HollowRecord
Code IndexAdd Tabnine to your IDE (free)

How to use
HollowRecord
in
com.netflix.hollow.api.objects

Best Java code snippets using com.netflix.hollow.api.objects.HollowRecord (Showing top 13 results out of 315)

origin: Netflix/hollow

@Override
public String stringify(HollowRecord record) {
  return stringify(record.getTypeDataAccess().getDataAccess(),
      record.getSchema().getName(), record.getOrdinal());
}
origin: Netflix/hollow

  public static boolean equalObject(String typeName, int ordinal, Object testObject) {
    if(testObject instanceof HollowRecord) {
      HollowRecord testRec = (HollowRecord)testObject;
      if(testRec.getOrdinal() == ordinal) {
        String otherType = testRec.getSchema().getName();

        return otherType.equals(typeName);
      }
    }
    return false;
  }
}
origin: Netflix/hollow

public int hashCode(String typeName, Object objectToHash) {
  if(objectToHash instanceof HollowRecord)
    return ((HollowRecord)objectToHash).getOrdinal();
  return objectToHash.hashCode();
}
origin: Netflix/hollow

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();
  }
}
origin: Netflix/hollow

@Test
public void testCompletelyMissingMap() throws IOException {
  roundTripSnapshot();
  readStateEngine.setMissingDataHandler(new FakeMissingDataHandler());
  GenericHollowMap map = (GenericHollowMap) GenericHollowRecordHelper.instantiate(readStateEngine, "MissingMap", 0);
  Assert.assertEquals(2, map.size());
  Assert.assertTrue(map.containsKey(new FakeMissingHollowRecord(new HollowObjectMissingDataAccess(readStateEngine, "MissingObject"), 2)));
  Assert.assertEquals(300, map.get(new FakeMissingHollowRecord(new HollowObjectMissingDataAccess(readStateEngine, "MissingObject"), 3)).getOrdinal());
  Assert.assertFalse(map.containsKey(new FakeMissingHollowRecord(new HollowObjectMissingDataAccess(readStateEngine, "MissingObject"), 0)));
  Assert.assertNull(map.get(new FakeMissingHollowRecord(new HollowObjectMissingDataAccess(readStateEngine, "MissingObject"), 4)));
  Iterator<Map.Entry<HollowRecord, HollowRecord>> rec = map.entrySet().iterator();
  Assert.assertTrue(rec.hasNext());
  Map.Entry<HollowRecord, HollowRecord> next = rec.next();
  Assert.assertEquals(2, next.getKey().getOrdinal());
  Assert.assertEquals("MissingObject", next.getKey().getSchema().getName());
  Assert.assertEquals(200, next.getValue().getOrdinal());
  Assert.assertEquals("MissingObject", next.getValue().getSchema().getName());
  Assert.assertTrue(rec.hasNext());
  next = rec.next();
  Assert.assertEquals(3, next.getKey().getOrdinal());
  Assert.assertEquals("MissingObject", next.getKey().getSchema().getName());
  Assert.assertEquals(300, next.getValue().getOrdinal());
  Assert.assertEquals("MissingObject", next.getValue().getSchema().getName());
  Assert.assertEquals(300, map.get(next.getKey()).getOrdinal());
  Assert.assertEquals("MissingObject", map.get(next.getKey()).getSchema().getName());
  Assert.assertFalse(rec.hasNext());
}
origin: Netflix/hollow

  @Test
  public void test() {
    HashIndexSelect<DataModel.Consumer.References, S, Integer> hi = HashIndex
        .from(consumer, DataModel.Consumer.References.class)
        .selectField(path, type)
        .usingPath("values._int", int.class);
    List<S> r = hi.findMatches(1)
        .collect(toList());
    Assert.assertEquals(1, r.size());
    Assert.assertTrue(type.isInstance(r.get(0)));
    Assert.assertEquals(0, r.get(0).getOrdinal());
  }
}
origin: Netflix/hollow

@Override
public String stringify(HollowRecord record) {
  return stringify(record.getTypeDataAccess().getDataAccess(), record.getSchema().getName(), record.getOrdinal());
}
origin: Netflix/hollow

@Test
public void testCompletelyMissingSet() throws IOException {
  roundTripSnapshot();
  readStateEngine.setMissingDataHandler(new FakeMissingDataHandler());
  GenericHollowSet set = (GenericHollowSet) GenericHollowRecordHelper.instantiate(readStateEngine, "MissingSet", 0);
  Assert.assertEquals(2, set.size());
  Assert.assertTrue(set.contains(new FakeMissingHollowRecord(new HollowObjectMissingDataAccess(readStateEngine, "MissingObject"), 2)));
  Assert.assertFalse(set.contains(new FakeMissingHollowRecord(new HollowObjectMissingDataAccess(readStateEngine, "MissingObject"), 0)));
  Iterator<HollowRecord> rec = set.iterator();
  Assert.assertTrue(rec.hasNext());
  HollowRecord next = rec.next();
  Assert.assertEquals(2, next.getOrdinal());
  Assert.assertEquals("MissingObject", next.getSchema().getName());
  Assert.assertTrue(rec.hasNext());
  next = rec.next();
  Assert.assertEquals(3, next.getOrdinal());
  Assert.assertEquals("MissingObject", next.getSchema().getName());
  Assert.assertFalse(rec.hasNext());
}
origin: Netflix/hollow

@Test
public void testLookupOfLongKey() throws IOException {
  HollowWriteStateEngine writeEngine = new HollowWriteStateEngine();
  HollowObjectMapper mapper = new HollowObjectMapper(writeEngine);
  mapper.initializeTypeState(TypeWithLongMap.class);
  
  TypeWithLongMap top = new TypeWithLongMap();
  long longValue = (long)Integer.MAX_VALUE+1;
  top.longMap.put(longValue, 100L);
  
  mapper.add(top);
  
  HollowReadStateEngine readEngine = StateEngineRoundTripper.roundTripSnapshot(writeEngine);
  
  GenericHollowMap map = new GenericHollowMap(readEngine, "MapOfLongToLong", 0);
  
  GenericHollowObject value = new GenericHollowObject(readEngine, "Long", map.findValue(longValue).getOrdinal());
  
  Assert.assertEquals(100L, value.getLong("value"));
}

origin: Netflix/hollow

@Override
public void stringify(Writer writer, HollowRecord record) throws IOException {
  stringify(writer, record.getTypeDataAccess().getDataAccess(), record.getSchema().getName(),
      record.getOrdinal());
}
origin: Netflix/hollow

@Test
public void testCompletelyMissingList() throws IOException {
  roundTripSnapshot();
  readStateEngine.setMissingDataHandler(new FakeMissingDataHandler());
  GenericHollowList list = (GenericHollowList) GenericHollowRecordHelper.instantiate(readStateEngine, "MissingList", 0);
  Assert.assertEquals(2, list.size());
  Assert.assertTrue(list.contains(new FakeMissingHollowRecord(new HollowObjectMissingDataAccess(readStateEngine, "MissingObject"), 2)));
  Assert.assertFalse(list.contains(new FakeMissingHollowRecord(new HollowObjectMissingDataAccess(readStateEngine, "MissingObject"), 0)));
  Iterator<HollowRecord> rec = list.iterator();
  Assert.assertTrue(rec.hasNext());
  HollowRecord next = rec.next();
  Assert.assertEquals(2, next.getOrdinal());
  Assert.assertEquals("MissingObject", next.getSchema().getName());
  Assert.assertTrue(rec.hasNext());
  next = rec.next();
  Assert.assertEquals(3, next.getOrdinal());
  Assert.assertEquals("MissingObject", next.getSchema().getName());
  Assert.assertFalse(rec.hasNext());
}
origin: Netflix/hollow

Assert.assertEquals("four", typeC0.getObject("c2").getString("b1"));
Assert.assertEquals(typeC0.getObject("c2").getOrdinal(), typeA0.getSet("a4").findElement("four").getOrdinal());
origin: Netflix/hollow

@Override
public void stringify(Writer writer, HollowRecord record) throws IOException {
  stringify(writer, record.getTypeDataAccess().getDataAccess(), record.getSchema().getName(), record.getOrdinal());
}
com.netflix.hollow.api.objectsHollowRecord

Javadoc

A HollowRecord is the base interface for accessing data from any kind of record in a Hollow dataset.

Most used methods

  • getOrdinal
  • getSchema
  • getDelegate
  • getTypeDataAccess

Popular in Java

  • Creating JSON documents from java classes using gson
  • setRequestProperty (URLConnection)
  • putExtra (Intent)
  • getSharedPreferences (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • JFrame (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now