You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2014/03/18 17:03:10 UTC

[2/6] git commit: Simplify the check of children's type.

Simplify the check of children's type.

It can be either Component or something else. We can use #getId(Object) only if it is a Component.

Reduces the check from two instanceof's to one.


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/e47e61e2
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/e47e61e2
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/e47e61e2

Branch: refs/heads/master
Commit: e47e61e28b704da9829edc9941c4c9fb6b2bf551
Parents: 0b37503
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Tue Mar 18 17:55:34 2014 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Tue Mar 18 17:55:34 2014 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/wicket/MarkupContainer.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/e47e61e2/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
index 68c16f7..30293fb 100644
--- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java
@@ -1107,7 +1107,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
 			return null;
 		}
 		Component component = null;
-		if ((children instanceof Object[] == false) && (children instanceof List == false))
+		if (children instanceof Component)
 		{
 			if (getId(children).equals(id))
 			{
@@ -1117,7 +1117,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
 		else
 		{
 			Object[] children;
-			int size = 0;
+			int size;
 			if (this.children instanceof ChildList)
 			{
 				children = ((ChildList)this.children).childs;
@@ -1151,7 +1151,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
 		{
 			return -1;
 		}
-		if (children instanceof Object[] == false && children instanceof ChildList == false)
+		if (children instanceof Component)
 		{
 			if (getId(children).equals(child.getId()))
 			{
@@ -1160,7 +1160,7 @@ public abstract class MarkupContainer extends Component implements Iterable<Comp
 		}
 		else
 		{
-			int size = 0;
+			int size;
 			Object[] children;
 			if (this.children instanceof Object[])
 			{