Skip to content

Commit

Permalink
Revert "Renamed Value.asObject => Value.getInnerObject"
Browse files Browse the repository at this point in the history
This reverts commit bfb04c9.
  • Loading branch information
pontusmelke committed Oct 27, 2017
1 parent 21a21f9 commit 54ebb9d
Show file tree
Hide file tree
Showing 35 changed files with 103 additions and 91 deletions.
Expand Up @@ -90,7 +90,7 @@ public void checkReference( RECORD record, DynamicRecord dynamicRecord,
public static long[] labelIds( List<DynamicRecord> recordList )
{
long[] idArray =
(long[]) getRightArray( readFullByteArrayFromHeavyRecords( recordList, PropertyType.ARRAY ) ).getInnerObject();
(long[]) getRightArray( readFullByteArrayFromHeavyRecords( recordList, PropertyType.ARRAY ) ).asObject();
return LabelIdArray.stripNodeId( idArray );
}

Expand Down
Expand Up @@ -743,7 +743,7 @@ public void shouldReportCyclesInDynamicRecordsWithLabels() throws Exception
protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
GraphStoreFixture.IdGenerator next )
{
long nodeId = ((long[]) getRightArray( readFullByteArrayFromHeavyRecords( chain, ARRAY ) ).getInnerObject())[0];
long nodeId = ((long[]) getRightArray( readFullByteArrayFromHeavyRecords( chain, ARRAY ) ).asObject())[0];
NodeRecord before = inUse( new NodeRecord( nodeId, false, -1, -1 ) );
NodeRecord after = inUse( new NodeRecord( nodeId, false, -1, -1 ) );
DynamicRecord record1 = chain.get( 0 ).clone();
Expand Down
Expand Up @@ -38,7 +38,7 @@ trait CypherSerializer {

val keyValStrings = if (deleted) Iterator("deleted")
else ops.propertyKeyIds(id).
map(pkId => qtx.getPropertyKeyName(pkId) + ":" + serialize(ops.getProperty(id, pkId).getInnerObject, qtx))
map(pkId => qtx.getPropertyKeyName(pkId) + ":" + serialize(ops.getProperty(id, pkId).asObject(), qtx))

keyValStrings.mkString("{", ",", "}")
}
Expand Down
Expand Up @@ -74,10 +74,10 @@ object indexQuery extends GraphElementPropertyFunctions {
case RangeQueryExpression(rangeWrapper) =>
val range = rangeWrapper match {
case s: PrefixSeekRangeExpression =>
s.range.map(expression => makeValueNeoSafe(expression(m, state)).getInnerObject)
s.range.map(expression => makeValueNeoSafe(expression(m, state)).asObject())

case InequalitySeekRangeExpression(innerRange) =>
innerRange.mapBounds(expression => makeValueNeoSafe(expression(m, state)).getInnerObject)
innerRange.mapBounds(expression => makeValueNeoSafe(expression(m, state)).asObject())
}
index(Seq(range)).toIterator
}
Expand All @@ -88,7 +88,7 @@ object indexQuery extends GraphElementPropertyFunctions {
if (values.contains(Values.NO_VALUE))
Iterator.empty
else {
val neoValues = values.map(makeValueNeoSafe).map(_.getInnerObject())
val neoValues = values.map(makeValueNeoSafe).map(_.asObject())
index(neoValues).toIterator
}
}
Expand Down
Expand Up @@ -53,14 +53,14 @@ class RuntimeTextValueConverter(scalaValues: RuntimeScalaValueConverter)(implici
private def props(n: Node): String = {
val ops = context.nodeOps
val properties = if (isVirtualEntityHack(n)) Iterator.empty else ops.propertyKeyIds(n.getId)
val keyValStrings = properties.map(pkId => s"${context.getPropertyKeyName(pkId)}:${asTextValue(ops.getProperty(n.getId, pkId).getInnerObject)}")
val keyValStrings = properties.map(pkId => s"${context.getPropertyKeyName(pkId)}:${asTextValue(ops.getProperty(n.getId, pkId).asObject())}")
keyValStrings.mkString("{", ",", "}")
}

private def props(r: Relationship): String = {
val ops = context.relationshipOps
val properties = if (isVirtualEntityHack(r)) Iterator.empty else ops.propertyKeyIds(r.getId)
val keyValStrings = properties.map(pkId => s"${context.getPropertyKeyName(pkId)}:${asTextValue(ops.getProperty(r.getId, pkId).getInnerObject)}")
val keyValStrings = properties.map(pkId => s"${context.getPropertyKeyName(pkId)}:${asTextValue(ops.getProperty(r.getId, pkId).asObject())}")
keyValStrings.mkString("{", ",", "}")
}

Expand Down
Expand Up @@ -308,7 +308,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper)
}

def getProperty(id: Long, propertyKeyId: Int): Any = try {
tc.statement.readOperations().nodeGetProperty(id, propertyKeyId).getInnerObject()
tc.statement.readOperations().nodeGetProperty(id, propertyKeyId).asObject()
} catch {
case _: org.neo4j.kernel.api.exceptions.EntityNotFoundException => null.asInstanceOf[Int]
}
Expand Down Expand Up @@ -378,7 +378,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper)
}

override def getProperty(id: Long, propertyKeyId: Int): Any = try {
tc.statement.readOperations().relationshipGetProperty(id, propertyKeyId).getInnerObject()
tc.statement.readOperations().relationshipGetProperty(id, propertyKeyId).asObject()
} catch {
case _: exceptions.EntityNotFoundException => null
}
Expand Down
Expand Up @@ -304,7 +304,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
}

override def getProperty(id: Long, propertyKeyId: Int): Any = try {
txContext.statement.readOperations().nodeGetProperty(id, propertyKeyId).getInnerObject
txContext.statement.readOperations().nodeGetProperty(id, propertyKeyId).asObject()
} catch {
case e: org.neo4j.kernel.api.exceptions.EntityNotFoundException =>
if (isDeletedInThisTx(id))
Expand Down Expand Up @@ -379,7 +379,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper)
}

override def getProperty(id: Long, propertyKeyId: Int): Any = try {
txContext.statement.readOperations().relationshipGetProperty(id, propertyKeyId).getInnerObject
txContext.statement.readOperations().relationshipGetProperty(id, propertyKeyId).asObject()
} catch {
case e: org.neo4j.kernel.api.exceptions.EntityNotFoundException =>
if (isDeletedInThisTx(id))
Expand Down
Expand Up @@ -247,7 +247,7 @@ final class TransactionBoundQueryContext(val transactionalContext: Transactional

case rangeGreaterThan: RangeGreaterThan[String] =>
rangeGreaterThan.limit(BY_STRING).map { limit =>
val rangePredicate = IndexQuery.range(index.property, limit.endPoint.asInstanceOf[String], limit.isInclusive, null, false)
val rangePredicate = IndexQuery.range(index.property, limit.endPoint.asInstanceOf[String], limit.isInclusive, null, false);
readOps.indexQuery(index, rangePredicate)
}.getOrElse(EMPTY_PRIMITIVE_LONG_COLLECTION.iterator)

Expand Down Expand Up @@ -311,7 +311,7 @@ final class TransactionBoundQueryContext(val transactionalContext: Transactional
}

override def getProperty(id: Long, propertyKeyId: Int): Any = try {
transactionalContext.statement.readOperations().nodeGetProperty(id, propertyKeyId).getInnerObject
transactionalContext.statement.readOperations().nodeGetProperty(id, propertyKeyId).asObject()
} catch {
case e: org.neo4j.kernel.api.exceptions.EntityNotFoundException =>
if (isDeletedInThisTx(id))
Expand Down Expand Up @@ -386,7 +386,7 @@ final class TransactionBoundQueryContext(val transactionalContext: Transactional
}

override def getProperty(id: Long, propertyKeyId: Int): Any = try {
transactionalContext.statement.readOperations().relationshipGetProperty(id, propertyKeyId).getInnerObject
transactionalContext.statement.readOperations().relationshipGetProperty(id, propertyKeyId).asObject()
} catch {
case e: org.neo4j.kernel.api.exceptions.EntityNotFoundException =>
if (isDeletedInThisTx(id))
Expand Down
Expand Up @@ -28,7 +28,6 @@

import org.neo4j.kernel.api.ReadOperations;
import org.neo4j.kernel.api.schema.index.IndexDescriptor;
import org.neo4j.values.storable.NumberValue;
import org.neo4j.values.storable.TextValue;
import org.neo4j.values.storable.Value;
import org.neo4j.values.storable.ValueTuple;
Expand Down Expand Up @@ -243,17 +242,17 @@ public Value value()

public static final class NumberRangePredicate extends IndexQuery
{
private final NumberValue from;
private final Value from;
private final boolean fromInclusive;
private final NumberValue to;
private final Value to;
private final boolean toInclusive;

NumberRangePredicate( int propertyKeyId, Number from, boolean fromInclusive, Number to, boolean toInclusive )
{
super( propertyKeyId );
this.from = from == null ? Values.MIN_NUMBER : Values.numberValue( from );
this.from = Values.numberValue( from );
this.fromInclusive = fromInclusive;
this.to = to == null ? Values.MAX_NUMBER : Values.numberValue( to );
this.to = Values.numberValue( to );
this.toInclusive = toInclusive;
}

Expand Down Expand Up @@ -295,20 +294,20 @@ public boolean test( Value value )

public Number from()
{
return from == Values.MIN_NUMBER ? null : (Number)from.getInnerObject();
return (Number)from.asObject();
}

public Number to()
{
return to == Values.MAX_NUMBER ? null : (Number)to.getInnerObject();
return (Number)to.asObject();
}

public NumberValue fromAsValue()
public Value fromAsValue()
{
return from;
}

public NumberValue toAsValue()
public Value toAsValue()
{
return to;
}
Expand Down Expand Up @@ -378,7 +377,7 @@ public boolean test( Value value )

public String from()
{
return (String)from.getInnerObject();
return (String)from.asObject();
}

public boolean fromInclusive()
Expand All @@ -388,7 +387,7 @@ public boolean fromInclusive()

public String to()
{
return (String)to.getInnerObject();
return (String)to.asObject();
}

public boolean toInclusive()
Expand Down Expand Up @@ -445,7 +444,7 @@ public IndexQueryType type()
@Override
public boolean test( Value value )
{
return value != null && Values.isTextValue( value ) && ((String)value.getInnerObject()).contains( contains );
return value != null && Values.isTextValue( value ) && ((String)value.asObject()).contains( contains );
}

public String contains()
Expand Down Expand Up @@ -473,7 +472,7 @@ public IndexQueryType type()
@Override
public boolean test( Value value )
{
return value != null && Values.isTextValue( value ) && ((String)value.getInnerObject()).endsWith( suffix );
return value != null && Values.isTextValue( value ) && ((String)value.asObject()).endsWith( suffix );
}

public String suffix()
Expand Down
Expand Up @@ -160,7 +160,7 @@ public void propertyAdded( DataWriteOperations ops, long entityId, int propertyK
if ( propertyKeysToInclude.get().contains( name ) )
{
ensureIndexExists( ops );
type.add( ops, entityId, name, value.getInnerObject() );
type.add( ops, entityId, name, value.asObject() );
}
}
catch ( ExplicitIndexNotFoundKernelException | EntityNotFoundException e )
Expand Down Expand Up @@ -189,8 +189,8 @@ public void propertyChanged( DataWriteOperations ops, long entityId, int propert
if ( propertyKeysToInclude.get().contains( name ) )
{
ensureIndexExists( ops );
type.remove( ops, entityId, name, oldValue.getInnerObject() );
type.add( ops, entityId, name, newValue.getInnerObject() );
type.remove( ops, entityId, name, oldValue.asObject() );
type.add( ops, entityId, name, newValue.asObject() );
}
}
catch ( ExplicitIndexNotFoundKernelException | EntityNotFoundException e )
Expand Down
Expand Up @@ -142,7 +142,7 @@ private static String stringOf( Value value )
{
if ( value != null && value != Values.NO_VALUE )
{
return Strings.prettyPrint( value.getInnerObject() );
return Strings.prettyPrint( value.asObject() );
}
return "";
}
Expand Down Expand Up @@ -179,7 +179,7 @@ static long indexEntryResourceId_4_x( long labelId, IndexQuery.ExactPredicate[]
{
int propertyKeyId = predicate.propertyKeyId();
Value v = predicate.value();
Object value = v.getInnerObject();
Object value = v.asObject();
Class<?> type = value.getClass();

hash = indexEntryHash_4_x.update( hash, propertyKeyId );
Expand Down
Expand Up @@ -217,6 +217,6 @@ public static Value getRightArray( Pair<byte[],byte[]> data )

public Object getArrayFor( Iterable<DynamicRecord> records )
{
return getRightArray( readFullByteArray( records, PropertyType.ARRAY ) ).getInnerObject();
return getRightArray( readFullByteArray( records, PropertyType.ARRAY ) ).asObject();
}
}
Expand Up @@ -81,7 +81,7 @@ public long[] getIfLoaded()
return null;
}
return stripNodeId( (long[]) getRightArray( readFullByteArrayFromHeavyRecords(
node.getUsedDynamicLabelRecords(), ARRAY ) ).getInnerObject() );
node.getUsedDynamicLabelRecords(), ARRAY ) ).asObject() );
}

@Override
Expand Down Expand Up @@ -226,22 +226,22 @@ public static long[] getDynamicLabelsArray( Iterable<DynamicRecord> records,
AbstractDynamicStore dynamicLabelStore )
{
long[] storedLongs = (long[])
DynamicArrayStore.getRightArray( dynamicLabelStore.readFullByteArray( records, PropertyType.ARRAY ) ).getInnerObject();
DynamicArrayStore.getRightArray( dynamicLabelStore.readFullByteArray( records, PropertyType.ARRAY ) ).asObject();
return LabelIdArray.stripNodeId( storedLongs );
}

public static long[] getDynamicLabelsArrayFromHeavyRecords( Iterable<DynamicRecord> records )
{
long[] storedLongs = (long[])
DynamicArrayStore.getRightArray( readFullByteArrayFromHeavyRecords( records, PropertyType.ARRAY ) ).getInnerObject();
DynamicArrayStore.getRightArray( readFullByteArrayFromHeavyRecords( records, PropertyType.ARRAY ) ).asObject();
return LabelIdArray.stripNodeId( storedLongs );
}

public static Pair<Long, long[]> getDynamicLabelsArrayAndOwner( Iterable<DynamicRecord> records,
AbstractDynamicStore dynamicLabelStore )
{
long[] storedLongs = (long[])
DynamicArrayStore.getRightArray( dynamicLabelStore.readFullByteArray( records, PropertyType.ARRAY ) ).getInnerObject();
DynamicArrayStore.getRightArray( dynamicLabelStore.readFullByteArray( records, PropertyType.ARRAY ) ).asObject();
return Pair.of(storedLongs[0], LabelIdArray.stripNodeId( storedLongs ));
}
}
Expand Up @@ -227,7 +227,7 @@ public static void encodeValue( PropertyBlock block, int keyId, Value value,
DynamicRecordAllocator stringAllocator, DynamicRecordAllocator arrayAllocator )
{
// TODO: use ValueWriter
Object asObject = value.getInnerObject();
Object asObject = value.asObject();
if ( asObject instanceof String )
{ // Try short string first, i.e. inlined in the property block
String string = (String) asObject;
Expand Down
Expand Up @@ -179,7 +179,7 @@ public String toString()
result.append( ",firstDynamic=" ).append( getSingleValueLong() );
break;
default:
Object value = type.value( this, null ).getInnerObject();
Object value = type.value( this, null ).asObject();
if ( value != null && value.getClass().isArray() )
{
int length = Array.getLength( value );
Expand Down
Expand Up @@ -606,7 +606,7 @@ private <ENTITY extends InputEntity, RECORD extends PrimitiveRecord> BiConsumer<
while ( cursor.next() )
{
scratch.add( cursor.propertyKeyId() ); // add key as int here as to have the importer use the token id
scratch.add( cursor.value().getInnerObject() );
scratch.add( cursor.value().asObject() );
}
entity.setProperties( scratch.isEmpty() ? InputEntity.NO_PROPERTIES : scratch.toArray() );
cursor.close();
Expand Down
Expand Up @@ -84,7 +84,7 @@ private static Object[] encode( Value[] propertyValues )

private static Object encode( Value value )
{
Object asObject = value.getInnerObject();
Object asObject = value.asObject();
if ( asObject instanceof Number )
{
asObject = ((Number) asObject).doubleValue();
Expand Down
Expand Up @@ -306,7 +306,7 @@ public void shouldUpdateNodePropertyValue() throws Exception

// THEN
ReadOperations readOperations = readOperationsInNewTransaction();
assertEquals( 42, readOperations.nodeGetProperty( nodeId, propertyId ).getInnerObject() );
assertEquals( 42, readOperations.nodeGetProperty( nodeId, propertyId ).asObject() );
commit();
}

Expand Down
Expand Up @@ -68,7 +68,7 @@ private Number[] generateNumberValues()
Number[] result = new Number[updates.length];
for ( int i = 0; i < updates.length; i++ )
{
result[i] = (Number) updates[i].values()[0].getInnerObject();
result[i] = (Number) updates[i].values()[0].asObject();
}
return result;
}
Expand Down
Expand Up @@ -190,8 +190,8 @@ private void assertSameOrder( List<Value> actual, List<Value> values )
assertEquals( actual.size(), values.size() );
for ( int i = 0; i < actual.size(); i++ )
{
Number actualAsNumber = (Number) actual.get( i ).getInnerObject();
Number valueAsNumber = (Number) values.get( i ).getInnerObject();
Number actualAsNumber = (Number) actual.get( i ).asObject();
Number valueAsNumber = (Number) values.get( i ).asObject();
//noinspection StatementWithEmptyBody
if ( Double.isNaN( actualAsNumber.doubleValue() ) && Double.isNaN( valueAsNumber.doubleValue() ) )
{
Expand Down

0 comments on commit 54ebb9d

Please sign in to comment.