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

How to use
GenericHollowSet
in
com.netflix.hollow.api.objects.generic

Best Java code snippets using com.netflix.hollow.api.objects.generic.GenericHollowSet (Showing top 8 results out of 315)

origin: Netflix/hollow

private boolean setOrderingExists(HollowSetTypeReadState bTypeState, String... orderedCValues) {
  for(int i=0;i<=bTypeState.maxOrdinal();i++) {
    GenericHollowSet set = new GenericHollowSet(bTypeState, i);
    Iterator<HollowRecord> iter = set.iterator();
    for(int j=0;j<orderedCValues.length;j++) {
      if(!iter.hasNext())
        break;
      HollowObject obj = (HollowObject)iter.next();
      String cValue = obj.getString("c1");
      if(!cValue.equals(orderedCValues[j]))
        break;
      if(j == (orderedCValues.length - 1))
        return true;
    }
  }
  return false;
}
origin: Netflix/hollow

@Override
public HollowRecord instantiateElement(int elementOrdinal) {
  return GenericHollowRecordHelper.instantiate(getTypeDataAccess().getDataAccess(), getSchema().getElementType(), elementOrdinal);
}
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

public static HollowRecord instantiate(HollowDataAccess dataAccess, String typeName, int ordinal) {
  HollowTypeDataAccess typeState = dataAccess.getTypeDataAccess(typeName, ordinal);
  if(typeState != null) {
    if(typeState instanceof HollowObjectTypeDataAccess)
      return new GenericHollowObject(new HollowObjectGenericDelegate((HollowObjectTypeDataAccess)typeState), ordinal);
    if(typeState instanceof HollowListTypeDataAccess)
      return new GenericHollowList(new HollowListLookupDelegate<HollowRecord>((HollowListTypeDataAccess)typeState), ordinal);
    if(typeState instanceof HollowSetTypeDataAccess)
      return new GenericHollowSet(new HollowSetLookupDelegate<HollowRecord>((HollowSetTypeDataAccess)typeState), ordinal);
    if(typeState instanceof HollowMapTypeDataAccess)
      return new GenericHollowMap(new HollowMapLookupDelegate<HollowRecord, HollowRecord>((HollowMapTypeDataAccess)typeState), ordinal);
  } else {
    HollowSchema schema = dataAccess.getMissingDataHandler().handleSchema(typeName);
    if(schema instanceof HollowObjectSchema)
      return new GenericHollowObject(new HollowObjectGenericDelegate(new HollowObjectMissingDataAccess(dataAccess, typeName)), ordinal);
    if(schema instanceof HollowListSchema)
      return new GenericHollowList(new HollowListLookupDelegate<HollowRecord>(new HollowListMissingDataAccess(dataAccess, typeName)), ordinal);
    if(schema instanceof HollowSetSchema)
      return new GenericHollowSet(new HollowSetLookupDelegate<HollowRecord>(new HollowSetMissingDataAccess(dataAccess, typeName)), ordinal);
    if(schema instanceof HollowMapSchema)
      return new GenericHollowMap(new HollowMapLookupDelegate<HollowRecord, HollowRecord>(new HollowMapMissingDataAccess(dataAccess, typeName)), ordinal);
  }
  throw new UnsupportedOperationException("I don't know how to instantiate a generic object given a " + typeState.getClass().getSimpleName());
}
origin: Netflix/hollow

Assert.assertEquals("two", typeA0.getString("a2"));
Assert.assertEquals("three", typeA0.getObject("a3").getString("b1"));
Assert.assertEquals(2, typeA0.getSet("a4").size());
Assert.assertTrue(typeA0.getSet("a4").findElement("four") != null);
Assert.assertTrue(typeA0.getSet("a4").findElement("five") != null);
Assert.assertEquals(4, typeA1.getSet("a4").size());
Assert.assertTrue(typeA1.getSet("a4").findElement("six") != null);
Assert.assertTrue(typeA1.getSet("a4").findElement("eight") != null);
Assert.assertTrue(typeA1.getSet("a4").findElement("é with acute accent") != null);
Assert.assertTrue(typeA1.getSet("a4").findElement("ten") != null);
Assert.assertEquals("four", typeC0.getObject("c2").getString("b1"));
Assert.assertEquals(typeC0.getObject("c2").getOrdinal(), typeA0.getSet("a4").findElement("four").getOrdinal());
origin: Netflix/hollow

GenericHollowObject element = (GenericHollowObject) obj.getSet("setById").findElement(1);
Assert.assertEquals("US", element.getObject("country").getString("value"));
element = (GenericHollowObject) obj.getSet("setById").findElement(2);
Assert.assertEquals("CA", element.getObject("country").getString("value"));
element = (GenericHollowObject) obj.getSet("setById").findElement(3);
Assert.assertEquals("IT", element.getObject("country").getString("value"));
element = (GenericHollowObject) obj.getSet("setById").findElement(4);
Assert.assertEquals("GB", element.getObject("country").getString("value"));
element = (GenericHollowObject) obj.getSet("setById").findElement(5);
Assert.assertEquals("IT", element.getObject("country").getString("value"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(1, "US");
Assert.assertEquals(1, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(2, "CA");
Assert.assertEquals(2, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(3, "IT");
Assert.assertEquals(3, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(4, "GB");
Assert.assertEquals(4, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(5, "IT");
Assert.assertEquals(5, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("intSet").findElement(100);
Assert.assertEquals(100, element.getInt("value"));
element = (GenericHollowObject)obj.getSet("intSet").findElement(200);
Assert.assertEquals(200, element.getInt("value"));
element = (GenericHollowObject)obj.getSet("intSet").findElement(300);
Assert.assertEquals(300, element.getInt("value"));
element = (GenericHollowObject)obj.getSet("intSet").findElement(400);
origin: Netflix/hollow

@Override
public boolean equalsElement(int elementOrdinal, Object testObject) {
  return GenericHollowRecordHelper.equalObject(getSchema().getElementType(), elementOrdinal, testObject);
}
origin: Netflix/hollow

GenericHollowObject element = (GenericHollowObject) obj.getSet("setById").findElement(1);
Assert.assertEquals("US", element.getObject("country").getString("value"));
element = (GenericHollowObject) obj.getSet("setById").findElement(2);
Assert.assertEquals("CA", element.getObject("country").getString("value"));
element = (GenericHollowObject) obj.getSet("setById").findElement(3);
Assert.assertEquals("IT", element.getObject("country").getString("value"));
element = (GenericHollowObject) obj.getSet("setById").findElement(4);
Assert.assertEquals("GB", element.getObject("country").getString("value"));
element = (GenericHollowObject) obj.getSet("setById").findElement(5);
Assert.assertEquals("IT", element.getObject("country").getString("value"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(1, "US");
Assert.assertEquals(1, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(2, "CA");
Assert.assertEquals(2, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(3, "IT");
Assert.assertEquals(3, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(4, "GB");
Assert.assertEquals(4, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("setByIdCountry").findElement(5, "IT");
Assert.assertEquals(5, element.getInt("id"));
element = (GenericHollowObject)obj.getSet("intSet").findElement(100);
Assert.assertEquals(100, element.getInt("value"));
element = (GenericHollowObject)obj.getSet("intSet").findElement(200);
Assert.assertEquals(200, element.getInt("value"));
element = (GenericHollowObject)obj.getSet("intSet").findElement(300);
Assert.assertEquals(300, element.getInt("value"));
element = (GenericHollowObject)obj.getSet("intSet").findElement(400);
com.netflix.hollow.api.objects.genericGenericHollowSet

Javadoc

This is a generic handle to a SET type record. The Generic Hollow Object API can be used to programmatically inspect a dataset (referenced by a HollowDataAccess) without a custom-generated API.

Most used methods

  • <init>
  • contains
  • findElement
  • getSchema
  • getTypeDataAccess
  • iterator
  • size

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Reference (javax.naming)
  • Table (org.hibernate.mapping)
    A relational table
  • 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