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

How to use
HollowObjectTypeDataAccess
in
com.netflix.hollow.core.read.dataaccess

Best Java code snippets using com.netflix.hollow.core.read.dataaccess.HollowObjectTypeDataAccess (Showing top 20 results out of 315)

origin: Netflix/hollow

HollowObjectSchema schema1 = typeAccess1.getSchema();
    Boolean bool1 = typeAccess1.readBoolean(ordinal1, fieldPosition1);
    Boolean bool2 = typeAccess2.readBoolean(ordinal2, fieldPosition2);
    return bool1 == bool2;
  case BYTES:
    byte[] data1 = typeAccess1.readBytes(ordinal1, fieldPosition1);
    byte[] data2 = typeAccess2.readBytes(ordinal2, fieldPosition2);
    return Arrays.equals(data1, data2);
  case DOUBLE:
    double d1 = typeAccess1.readDouble(ordinal1, fieldPosition1);
    double d2 = typeAccess2.readDouble(ordinal2, fieldPosition2);
    return Double.compare(d1, d2) == 0;
  case FLOAT:
    float f1 = typeAccess1.readFloat(ordinal1, fieldPosition1);
    float f2 = typeAccess2.readFloat(ordinal2, fieldPosition2);
    return Float.compare(f1, f2) == 0;
  case INT:
    int i1 = typeAccess1.readInt(ordinal1, fieldPosition1);
    int i2 = typeAccess2.readInt(ordinal2, fieldPosition2);
    return i1 == i2;
  case LONG:
    long l1 = typeAccess1.readLong(ordinal1, fieldPosition1);
    long l2 = typeAccess2.readLong(ordinal2, fieldPosition2);
    return l1 == l2;
  case STRING:
    String s1 = typeAccess1.readString(ordinal1, fieldPosition1);
    return typeAccess2.isStringFieldEqual(ordinal2, fieldPosition2, s1);
  case REFERENCE:
origin: Netflix/hollow

private int fieldHashCode(HollowEffigy element, int[] fieldPath) {
  HollowObjectTypeDataAccess dataAccess = (HollowObjectTypeDataAccess) element.getDataAccess();
  HollowObjectSchema schema = dataAccess.getSchema();
  int ordinal = element.getOrdinal();
  for (int i = 0; i < fieldPath.length - 1; i++) {
    int fieldPosition = fieldPath[i];
    ordinal = dataAccess.readOrdinal(ordinal, fieldPosition);
    dataAccess = (HollowObjectTypeDataAccess) dataAccess.getDataAccess().getTypeDataAccess(schema.getReferencedType(fieldPosition));
    schema = dataAccess.getSchema();
  }
  int fieldHash = HollowReadFieldUtils.fieldHashCode(dataAccess, ordinal, fieldPath[fieldPath.length-1]);
  return HashCodes.hashInt(fieldHash);
}

origin: Netflix/hollow

  private Object readFromObject(HollowObjectTypeDataAccess objectTypeDataAccess, int ordinal, FieldType fieldType, int fieldPosition) {
    Object value;
    switch (fieldType) {
      case INT:
        value = objectTypeDataAccess.readInt(ordinal, fieldPosition);
        break;
      case LONG:
        value = objectTypeDataAccess.readLong(ordinal, fieldPosition);
        break;
      case DOUBLE:
        value = objectTypeDataAccess.readDouble(ordinal, fieldPosition);
        break;
      case FLOAT:
        value = objectTypeDataAccess.readFloat(ordinal, fieldPosition);
        break;
      case BOOLEAN:
        value = objectTypeDataAccess.readBoolean(ordinal, fieldPosition);
        break;
      case STRING:
        value = objectTypeDataAccess.readString(ordinal, fieldPosition);
        break;
      default:
        throw new IllegalStateException("Invalid field type :" + fieldType + " cannot read values for this type");

    }
    return value;
  }
}
origin: Netflix/hollow

HollowObjectSchema schema = typeAccess.getSchema();
    Boolean bool = typeAccess.readBoolean(ordinal, fieldPosition);
    return booleanHashCode(bool);
  case BYTES:
  case STRING:
    return typeAccess.findVarLengthFieldHashCode(ordinal, fieldPosition);
  case DOUBLE:
    double d = typeAccess.readDouble(ordinal, fieldPosition);
    return doubleHashCode(d);
  case FLOAT:
    float f = typeAccess.readFloat(ordinal, fieldPosition);
    return floatHashCode(f);
  case INT:
    return intHashCode(typeAccess.readInt(ordinal, fieldPosition));
  case LONG:
    long l = typeAccess.readLong(ordinal, fieldPosition);
    return longHashCode(l);
  case REFERENCE:
    return typeAccess.readOrdinal(ordinal, fieldPosition);
origin: Netflix/hollow

@Override
public HollowObjectSchema getSchema() {
  return dataAccess.getSchema();
}
origin: Netflix/hollow

private String roundTripReferenceStringValue(String value) throws IOException {
  HollowObjectMapper mapper = new HollowObjectMapper(writeStateEngine);
  mapper.add(new TypeA(value, 1, null, null));
  roundTripSnapshot();
  HollowObjectTypeDataAccess typeDataAccess = (HollowObjectTypeDataAccess) readStateEngine.getTypeDataAccess("TypeA");
  int stringFieldIndex = typeDataAccess.getSchema().getPosition("a1");
  int stringValueOrdinal = typeDataAccess.readOrdinal(0, stringFieldIndex);
  HollowObjectTypeDataAccess stringDataAccess = (HollowObjectTypeDataAccess) readStateEngine.getTypeDataAccess("String");
  int stringValueField = stringDataAccess.getSchema().getPosition("value");
  return stringDataAccess.readString(stringValueOrdinal, stringValueField);
}
origin: Netflix/hollow

  @Override
  public boolean shouldIndex(int ordinal) {
    HollowObjectTypeDataAccess objectTypeDataAccess = (HollowObjectTypeDataAccess) readStateEngine.getTypeDataAccess("Movie");
    int yearReleasedFieldPosition = objectTypeDataAccess.getSchema().getPosition("releaseYear");
    int yearReleased = objectTypeDataAccess.readInt(ordinal, yearReleasedFieldPosition);
    if (yearReleased == 2009)
      return true;
    return false;
  }
};
origin: Netflix/hollow

@Override
public int readOrdinal(int ordinal, int fieldIndex) {
  return ((HollowObjectTypeDataAccess) currentDataAccess).readOrdinal(ordinal, fieldIndex);
}
origin: Netflix/hollow

private String roundTripInlinedStringValue(String value) throws IOException {
  HollowObjectMapper mapper = new HollowObjectMapper(writeStateEngine);
  mapper.add(new TypeD(value));
  roundTripSnapshot();
  HollowObjectTypeDataAccess typeDataAccess = (HollowObjectTypeDataAccess) readStateEngine.getTypeDataAccess("TypeD");
  int stringFieldIndex = typeDataAccess.getSchema().getPosition("inlinedString");
  return typeDataAccess.readString(0, stringFieldIndex);
}
origin: Netflix/hollow

@Test
public void testClientAPIHoldsLongLivedReferences() throws IOException {
  client.triggerRefreshTo(1);
  HollowAPI api = client.getAPI();
  HollowObjectTypeDataAccess dataAccess = (HollowObjectTypeDataAccess) api.getDataAccess().getTypeDataAccess("TestObject");
  client.triggerRefreshTo(2);
  client.triggerRefreshTo(3);
  client.triggerRefreshTo(4);
  Assert.assertEquals(1, dataAccess.readInt(1, 0));
  Assert.assertEquals("one", dataAccess.readString(1, 1));
  Assert.assertEquals(3, dataAccess.readInt(3, 0));
  Assert.assertEquals("three", dataAccess.readString(3, 1));
}
origin: Netflix/hollow

@Override
public int readInt(int ordinal, int fieldIndex) {
  return ((HollowObjectTypeDataAccess) currentDataAccess).readInt(ordinal, fieldIndex);
}
origin: Netflix/hollow

  int fieldIdx = objectAccess.getSchema().getPosition(fieldIdentifier.getParents().get(level+1).getViaFieldName());
  childDataAccess = typeDataAccess.getDataAccess().getTypeDataAccess(objectAccess.getSchema().getReferencedType(fieldIdx));
  for(int i=0;i<ordinals.size();i++)
    childOrdinals.add(objectAccess.readOrdinal(ordinals.get(i), fieldIdx));
} else if(typeDataAccess instanceof HollowCollectionTypeDataAccess) {
  HollowCollectionTypeDataAccess collectionAccess = (HollowCollectionTypeDataAccess)typeDataAccess;
origin: Netflix/hollow

@Override
public String readString(int ordinal, int fieldIndex) {
  return ((HollowObjectTypeDataAccess) currentDataAccess).readString(ordinal, fieldIndex);
}
origin: Netflix/hollow

private void appendObjectStringify(Writer writer, HollowDataAccess dataAccess, HollowObjectTypeDataAccess typeDataAccess, int ordinal, int indentation) throws IOException {
  HollowObjectSchema schema = typeDataAccess.getSchema();
  if(schema.numFields() == 1 && (collapseAllSingleFieldObjects || collapseObjectTypes.contains(schema.getName()))) {
    appendFieldStringify(writer, dataAccess, indentation, schema, typeDataAccess, ordinal, 0);
  } else {
    writer.append("{");
    boolean firstField = true;
    indentation++;
    for(int i=0;i<schema.numFields();i++) {
      String fieldName = schema.getFieldName(i);
      if(!typeDataAccess.isNull(ordinal, i)) {
        if(firstField)
          firstField = false;
        else
          writer.append(",");
        if(prettyPrint) {
          writer.append(NEWLINE);
          appendIndentation(writer, indentation);
        }
        writer.append("\"").append(fieldName).append("\": ");
        appendFieldStringify(writer, dataAccess, indentation, schema, typeDataAccess, ordinal, i);
      }
    }
    if(prettyPrint && !firstField) {
      writer.append(NEWLINE);
      appendIndentation(writer, indentation - 1);
    }
    writer.append("}");
  }
}
origin: Netflix/hollow

@Override
public long readLong(int ordinal, int fieldIndex) {
  return ((HollowObjectTypeDataAccess) currentDataAccess).readLong(ordinal, fieldIndex);
}
origin: Netflix/hollow

@Override
public Boolean readBoolean(int ordinal, int fieldIndex) {
  return ((HollowObjectTypeDataAccess) currentDataAccess).readBoolean(ordinal, fieldIndex);
}
origin: Netflix/hollow

@Override
public double readDouble(int ordinal, int fieldIndex) {
  return ((HollowObjectTypeDataAccess) currentDataAccess).readDouble(ordinal, fieldIndex);
}
origin: Netflix/hollow

@Override
public float readFloat(int ordinal, int fieldIndex) {
  return ((HollowObjectTypeDataAccess) currentDataAccess).readFloat(ordinal, fieldIndex);
}
origin: Netflix/hollow

@Override
public byte[] readBytes(int ordinal, int fieldIndex) {
  return ((HollowObjectTypeDataAccess) currentDataAccess).readBytes(ordinal, fieldIndex);
}
origin: Netflix/hollow

  private MissingDataHandler missingDataHandler() {
    return getTypeDataAccess().getDataAccess().getMissingDataHandler();
  }
}
com.netflix.hollow.core.read.dataaccessHollowObjectTypeDataAccess

Javadoc

A handle for all of the records of a specific OBJECT type in a Hollow dataset. The most common type of HollowObjectTypeDataAccessis a HollowObjectTypeReadState.

Most used methods

  • getSchema
  • readInt
  • readOrdinal
  • readString
  • getDataAccess
  • readBoolean
  • readBytes
  • readDouble
  • readFloat
  • readLong
  • findVarLengthFieldHashCode
  • isNull
  • findVarLengthFieldHashCode,
  • isNull,
  • isStringFieldEqual

Popular in Java

  • Reading from database using SQL prepared statement
  • setContentView (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • requestLocationUpdates (LocationManager)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • JTextField (javax.swing)
  • Top 12 Jupyter Notebook extensions
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