Skip to content

Commit

Permalink
[JBRULES-3257] make the api backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
mariofusco authored and Marco Rietveld committed Nov 17, 2011
1 parent 0d096c1 commit 58a1b9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Expand Up @@ -38,7 +38,7 @@ public static void writeWorkItem_v1(MarshallerWriteContext context, WorkItem wor
Object object = parameters.get( key );
if ( object != null ) {
stream.writeUTF( key );
int index = context.objectMarshallingStrategyStore.getStrategyIndex( object );
int index = context.objectMarshallingStrategyStore.getStrategy( object );
stream.writeInt( index );
ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategy( index );
if ( strategy.accept( object ) ) {
Expand Down Expand Up @@ -76,7 +76,7 @@ public static void writeFactHandle_v1(MarshallerWriteContext context,
Object object = handle.getObject();

if ( object != null ) {
int index = objectMarshallingStrategyStore.getStrategyIndex( object );
int index = objectMarshallingStrategyStore.getStrategy( object );

ObjectMarshallingStrategy strategy = objectMarshallingStrategyStore.getStrategy( index );

Expand Down
Expand Up @@ -31,7 +31,7 @@ public ObjectMarshallingStrategy getStrategy(int index) {
return this.strategiesList[ index ];
}

public int getStrategyIndex(Object object) {
public int getStrategy(Object object) {
for ( int i = 0, length = this.strategiesList.length; i < length; i++ ) {
if ( strategiesList[i].accept( object ) ) {
return i;
Expand All @@ -54,7 +54,7 @@ public ObjectMarshallingStrategy getStrategyObject(String strategyClassName) {
return objectMarshallingStrategy;
}

public ObjectMarshallingStrategy getStrategy(Object object) {
public ObjectMarshallingStrategy getStrategyObject(Object object) {
for ( int i = 0, length = this.strategiesList.length; i < length; i++ ) {
if ( strategiesList[i].accept( object ) ) {
return strategiesList[i];
Expand Down
Expand Up @@ -397,7 +397,7 @@ private static void writeFactHandle(MarshallerWriteContext context,
// Now, we write -2 to indicate that we write the strategy class name to the stream
stream.writeInt(-2);
if ( object != null ) {
ObjectMarshallingStrategy strategy = objectMarshallingStrategyStore.getStrategy( object );
ObjectMarshallingStrategy strategy = objectMarshallingStrategyStore.getStrategyObject( object );

String strategyClassName = strategy.getClass().getName();
stream.writeUTF(strategyClassName);
Expand Down Expand Up @@ -1086,7 +1086,7 @@ public static void writeWorkItem(MarshallerWriteContext context,
if ( object != null ) {
stream.writeUTF( key );

ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategy( object );
ObjectMarshallingStrategy strategy = context.objectMarshallingStrategyStore.getStrategyObject( object );
String strategyClassName = strategy.getClass().getName();
stream.writeInt(-2); // backwards compatibility
stream.writeUTF(strategyClassName);
Expand Down

0 comments on commit 58a1b9d

Please sign in to comment.