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 @Override
public void writeEdgeReference( long edgeId ) throws RuntimeException 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 @Override
public void beginMap( int size ) throws RuntimeException public void beginMap( int size ) throws RuntimeException
{ {
Expand Down Expand Up @@ -389,7 +377,7 @@ public void writeByteArray( byte[] value ) throws RuntimeException
} }


@Override @Override
public void writeJavaObject( Object object ) public void writeArbitraryJavaObject( Object object )
{ {
writeValue( 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 ) if ( id() < 0 )
{ {
writer.writeVirtualNodeHack( node ); writer.writeArbitraryJavaObject( node );
} }


writer.writeNode( node.getId(), l, p ); 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 ) if ( id() < 0 )
{ {
writer.writeVirtualEdgeHack( relationship ); writer.writeArbitraryJavaObject( relationship );
} }


writer.writeEdge( id(), startNode().id(), endNode().id(), type(), p ); writer.writeEdge( id(), startNode().id(), endNode().id(), type(), p );
Expand Down
Expand Up @@ -323,7 +323,7 @@ protected int computeHash()
@Override @Override
public <E extends Exception> void writeTo( AnyValueWriter<E> writer ) throws E 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; void endPoint() throws E;


default void writeVirtualNodeHack( Object node ) /**
{ * This is a temporary hack in order to support some cases for procedures where we
// do nothing, this is an ugly hack. * hadn't been careful enough about sanitizing inputs
} *

* @param object the object to serialize.
default void writeVirtualEdgeHack( Object relationship ) */
{ @Deprecated
// do nothing, this is an ugly hack. default void writeArbitraryJavaObject( Object object )
}

default void writeJavaObject( Object object )
{ {
// do nothing, this is an ugly hack. // do nothing, this is an ugly hack.
} }
Expand Down

0 comments on commit 8d706ca

Please sign in to comment.