Skip to content

Commit

Permalink
Combine three hacks into one, now profit!
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed Oct 15, 2017
1 parent b783357 commit 8d706ca
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 27 deletions.
Expand Up @@ -99,12 +99,6 @@ public void writeNode( long nodeId, TextArray ignore, MapValue properties ) thro
}
}

@Override
public void writeVirtualNodeHack( Object node )
{
writeValue( node );
}

@Override
public void writeEdgeReference( long edgeId ) throws RuntimeException
{
Expand All @@ -121,12 +115,6 @@ public void writeEdge( long edgeId, long startNodeId, long endNodeId, TextValue
}
}

@Override
public void writeVirtualEdgeHack( Object relationship )
{
writeValue( relationship );
}

@Override
public void beginMap( int size ) throws RuntimeException
{
Expand Down Expand Up @@ -389,7 +377,7 @@ public void writeByteArray( byte[] value ) throws RuntimeException
}

@Override
public void writeJavaObject( Object object )
public void writeArbitraryJavaObject( Object object )
{
writeValue( object );
}
Expand Down
Expand Up @@ -67,7 +67,7 @@ public <E extends Exception> void writeTo( AnyValueWriter<E> writer ) throws E

if ( id() < 0 )
{
writer.writeVirtualNodeHack( node );
writer.writeArbitraryJavaObject( node );
}

writer.writeNode( node.getId(), l, p );
Expand Down
Expand Up @@ -64,7 +64,7 @@ public <E extends Exception> void writeTo( AnyValueWriter<E> writer ) throws E

if ( id() < 0 )
{
writer.writeVirtualEdgeHack( relationship );
writer.writeArbitraryJavaObject( relationship );
}

writer.writeEdge( id(), startNode().id(), endNode().id(), type(), p );
Expand Down
Expand Up @@ -323,7 +323,7 @@ protected int computeHash()
@Override
public <E extends Exception> void writeTo( AnyValueWriter<E> writer ) throws E
{
writer.writeJavaObject( object );
writer.writeArbitraryJavaObject( object );
}
}
}
Expand Up @@ -54,17 +54,14 @@ public interface AnyValueWriter<E extends Exception> extends ValueWriter<E>

void endPoint() throws E;

default void writeVirtualNodeHack( Object node )
{
// do nothing, this is an ugly hack.
}

default void writeVirtualEdgeHack( Object relationship )
{
// do nothing, this is an ugly hack.
}

default void writeJavaObject( Object object )
/**
* This is a temporary hack in order to support some cases for procedures where we
* hadn't been careful enough about sanitizing inputs
*
* @param object the object to serialize.
*/
@Deprecated
default void writeArbitraryJavaObject( Object object )
{
// do nothing, this is an ugly hack.
}
Expand Down

0 comments on commit 8d706ca

Please sign in to comment.