wicket-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgrigo...@apache.org
Subject git commit: Use Args to check for proper input arguments. Chain constructors
Date Mon, 09 Jan 2012 14:55:53 GMT
Updated Branches:
  refs/heads/master 3340feff8 -> ba2a4177d


Use Args to check for proper input arguments.
Chain constructors


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

Branch: refs/heads/master
Commit: ba2a4177d1391d875ae60f25c69e1dc5186112c0
Parents: 3340fef
Author: martin-g <mgrigorov@apache.org>
Authored: Mon Jan 9 16:55:45 2012 +0200
Committer: martin-g <mgrigorov@apache.org>
Committed: Mon Jan 9 16:55:45 2012 +0200

----------------------------------------------------------------------
 .../injection/CompoundFieldValueFactory.java       |   32 +++++----------
 1 files changed, 10 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/ba2a4177/wicket-ioc/src/main/java/org/apache/wicket/injection/CompoundFieldValueFactory.java
----------------------------------------------------------------------
diff --git a/wicket-ioc/src/main/java/org/apache/wicket/injection/CompoundFieldValueFactory.java
b/wicket-ioc/src/main/java/org/apache/wicket/injection/CompoundFieldValueFactory.java
index ed5a22e..f1cdce8 100644
--- a/wicket-ioc/src/main/java/org/apache/wicket/injection/CompoundFieldValueFactory.java
+++ b/wicket-ioc/src/main/java/org/apache/wicket/injection/CompoundFieldValueFactory.java
@@ -21,6 +21,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.wicket.util.lang.Args;
+
 /**
  * Compound implementation of IFieldValueFactory. This field value factory will keep trying
added
  * factories until one returns a non-null value or all are tried.
@@ -42,12 +44,7 @@ public class CompoundFieldValueFactory implements IFieldValueFactory
 	 */
 	public CompoundFieldValueFactory(final IFieldValueFactory[] factories)
 	{
-		if (factories == null)
-		{
-			throw new IllegalArgumentException("argument [factories] cannot be null");
-		}
-
-		delegates.addAll(Arrays.asList(factories));
+		this(Arrays.asList(factories));
 	}
 
 	/**
@@ -57,10 +54,8 @@ public class CompoundFieldValueFactory implements IFieldValueFactory
 	 */
 	public CompoundFieldValueFactory(final List<IFieldValueFactory> factories)
 	{
-		if (factories == null)
-		{
-			throw new IllegalArgumentException("argument [factories] cannot be null");
-		}
+		Args.notNull(factories, "factories");
+
 		delegates.addAll(factories);
 	}
 
@@ -72,14 +67,9 @@ public class CompoundFieldValueFactory implements IFieldValueFactory
 	 */
 	public CompoundFieldValueFactory(final IFieldValueFactory f1, final IFieldValueFactory f2)
 	{
-		if (f1 == null)
-		{
-			throw new IllegalArgumentException("argument [f1] cannot be null");
-		}
-		if (f2 == null)
-		{
-			throw new IllegalArgumentException("argument [f2] cannot be null");
-		}
+		Args.notNull(f1, "f1");
+		Args.notNull(f2, "f2");
+
 		delegates.add(f1);
 		delegates.add(f2);
 	}
@@ -91,10 +81,8 @@ public class CompoundFieldValueFactory implements IFieldValueFactory
 	 */
 	public void addFactory(final IFieldValueFactory factory)
 	{
-		if (factory == null)
-		{
-			throw new IllegalArgumentException("argument [factory] cannot be null");
-		}
+		Args.notNull(factory, "factory");
+
 		delegates.add(factory);
 	}
 


Mime
View raw message