Skip to content

Commit 124aad7

Browse files
author
zhourenjian@gmail.com
committed
For SimpleSerializable objects, just pipe it through directly, no needs of converting them
1 parent 5d61c50 commit 124aad7

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

sources/net.sf.j2s.ajax/ajaxpipe/net/sf/j2s/ajax/SimplePipeRunnable.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,12 @@ protected void updateStatus(boolean live) {
402402
* @return SimpleSerializable objects to be sent through the pipe.
403403
* If return null, it means that this pipe does not recognize the
404404
* argument objects.
405+
*
406+
* @j2sIgnore
405407
*/
406-
public abstract SimpleSerializable[] through(Object ... args);
408+
public SimpleSerializable[] through(Object ... args) {
409+
return null;
410+
}
407411

408412
/**
409413
* Deal the object from pipe.
@@ -453,8 +457,9 @@ public boolean deal(SimpleSerializable ss) {
453457
/**
454458
* A method used to pipe a bundle of instances through.
455459
*
456-
* Attention: Only visible inside {@link #pipeSetup()}.
457-
* @param args
460+
* @param args Normal objects
461+
*
462+
* @j2sIgnore
458463
*/
459464
public void pipeThrough(Object ... args) {
460465
SimplePipeRunnable pipe = SimplePipeHelper.getPipe(pipeKey);
@@ -474,5 +479,28 @@ public void pipeThrough(Object ... args) {
474479
pipe.deal(objs[i]);
475480
}
476481
}
482+
483+
/**
484+
* A method used to pipe a bundle of instances through.
485+
*
486+
* @param args SimpleSerializable objects
487+
*
488+
* @j2sIgnore
489+
*/
490+
public void pipeThrough(SimpleSerializable ... args) {
491+
if (args == null || args.length == 0) return;
492+
SimplePipeRunnable pipe = SimplePipeHelper.getPipe(pipeKey);
493+
if (pipe == null) return;
494+
if (pipe instanceof SimplePipeRunnable) {
495+
SimplePipeRunnable pipeRunnable = (SimplePipeRunnable) pipe;
496+
if (pipeRunnable.helper != null) {
497+
pipeRunnable.helper.helpThrough(pipe, args);
498+
return;
499+
}
500+
}
501+
for (int i = 0; i < args.length; i++) {
502+
pipe.deal(args[i]);
503+
}
504+
}
477505

478506
}

0 commit comments

Comments
 (0)