Author: rhauch
Date: 2008-09-18 14:12:00 -0400 (Thu, 18 Sep 2008)
New Revision: 535
Added:
trunk/dna-common/src/main/java/org/jboss/dna/common/util/CheckArg.java
Removed:
trunk/dna-common/src/main/java/org/jboss/dna/common/util/ArgCheck.java
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentConfig.java
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java
trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/I18n.java
trunk/dna-common/src/main/java/org/jboss/dna/common/text/Inflector.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/IoUtil.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/Reflection.java
trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java
trunk/dna-common/src/test/java/org/jboss/dna/common/util/ArgCheckTest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContexts.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/BasicCachePolicy.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connectors/BasicExecutionContext.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connectors/RepositoryConnectionPool.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/PathExpression.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/AbstractValueFactories.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/AbstractValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicMultiValueProperty.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicName.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicNamespaceRegistry.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPath.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPathSegment.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPropertyFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/InMemoryBinary.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/JodaDateTime.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/NameValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/ObjectValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/PathValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/StandardValueFactories.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/StringValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/UriValueFactory.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/util/GraphImporter.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connectors/RepositoryOperations.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/properties/AbstractValueComparatorsTest.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrProperty.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeIterator.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrProperty.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrPropertyIterator.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSet.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerNodeContext.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerOutputMap.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerPathExpression.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/AbstractSessionFactory.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/BasicJcrExecutionContext.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrNamespaceRegistry.java
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JndiSessionFactory.java
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
trunk/eclipse-preferences.epf
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenDependency.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenId.java
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepository.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositoryConfig.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/Projection.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/ProjectionParser.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ContributionStatistics.java
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MergePlan.java
trunk/extensions/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepository.java
trunk/extensions/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepositorySource.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java
Log:
DNA-205 Rename/refactor classes
https://jira.jboss.org/jira/browse/DNA-205
Renamed 'org.jboss.dna.common.util.ArgCheck' to 'CheckArg', since that
makes more more readable code. This impacted a lot of code.
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/collection/Problem.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -23,7 +23,7 @@
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.i18n.I18n;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
/**
@@ -55,8 +55,8 @@
String resource,
String location,
Throwable throwable ) {
- ArgCheck.isNotNull(status, "status");
- ArgCheck.isNotNull(message, "message");
+ CheckArg.isNotNull(status, "status");
+ CheckArg.isNotNull(message, "message");
this.status = status;
this.code = code;
this.message = message;
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentConfig.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentConfig.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentConfig.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -26,7 +26,7 @@
import java.util.List;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.CommonI18n;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.ClassUtil;
/**
@@ -65,7 +65,7 @@
* Java classname
*/
public ComponentConfig( String name, String description, long timestamp, String
classname, String... classpath ) {
- ArgCheck.isNotEmpty(name, "name");
+ CheckArg.isNotEmpty(name, "name");
this.name = name.trim();
this.description = description != null ? description.trim() : "";
this.componentClassname = classname;
@@ -181,8 +181,8 @@
* this object
*/
public boolean hasChanged( ComponentConfig component ) {
- ArgCheck.isNotNull(component, "component");
- ArgCheck.isInstanceOf(component, this.getClass(), "component");
+ CheckArg.isNotNull(component, "component");
+ CheckArg.isInstanceOf(component, this.getClass(), "component");
if (!this.getName().equalsIgnoreCase(component.getName())) return true;
if (!this.getDescription().equals(component.getDescription())) return true;
if (!this.getComponentClassname().equals(component.getComponentClassname()))
return true;
Modified:
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java
===================================================================
---
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-common/src/main/java/org/jboss/dna/common/component/ComponentLibrary.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -32,7 +32,7 @@
import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.CommonI18n;
import org.jboss.dna.common.SystemFailureException;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
/**
* Maintains the list of component instances for the system. This class does not actively
update the component configurations, but
@@ -128,7 +128,7 @@
* @see #remove(ComponentConfig)
*/
public boolean add( ConfigType config ) {
- ArgCheck.isNotNull(config, "component configuration");
+ CheckArg.isNotNull(config, "component configuration");
try {
this.lock.lock();
// Find an existing configuration that matches ...
@@ -182,7 +182,7 @@
* @see #update(ComponentConfig)
*/
public boolean remove( ConfigType config ) {
- ArgCheck.isNotNull(config, "component configuration");
+ CheckArg.isNotNull(config, "component configuration");
try {
this.lock.lock();
// Find an existing configuration that matches ...
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/I18n.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/I18n.java 2008-09-18 18:00:04
UTC (rev 534)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/i18n/I18n.java 2008-09-18 18:12:00
UTC (rev 535)
@@ -39,7 +39,7 @@
import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.CommonI18n;
import org.jboss.dna.common.SystemFailureException;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.ClassUtil;
import org.jboss.dna.common.util.StringUtil;
@@ -71,7 +71,7 @@
* class; never <code>null</code>.
*/
public static Set<Locale> getLocalizationProblemLocales( Class<?>
i18nClass ) {
- ArgCheck.isNotNull(i18nClass, "i18nClass");
+ CheckArg.isNotNull(i18nClass, "i18nClass");
Set<Locale> locales = new
HashSet<Locale>(LOCALE_TO_CLASS_TO_PROBLEMS_MAP.size());
for (Entry<Locale, Map<Class<?>, Set<String>>>
localeEntry : LOCALE_TO_CLASS_TO_PROBLEMS_MAP.entrySet()) {
for (Entry<Class<?>, Set<String>> classEntry :
localeEntry.getValue().entrySet()) {
@@ -106,7 +106,7 @@
*/
public static Set<String> getLocalizationProblems( Class<?> i18nClass,
Locale locale ) {
- ArgCheck.isNotNull(i18nClass, "i18nClass");
+ CheckArg.isNotNull(i18nClass, "i18nClass");
Map<Class<?>, Set<String>> classToProblemsMap =
LOCALE_TO_CLASS_TO_PROBLEMS_MAP.get(locale == null ? Locale.getDefault() : locale);
if (classToProblemsMap == null) {
return Collections.emptySet();
@@ -147,7 +147,7 @@
* @param i18nClass A class declaring one or more public, static, non-final fields of
type <code>I18n</code>.
*/
public static void initialize( Class<?> i18nClass ) {
- ArgCheck.isNotNull(i18nClass, "i18nClass");
+ CheckArg.isNotNull(i18nClass, "i18nClass");
if (i18nClass.isInterface()) {
throw new
IllegalArgumentException(CommonI18n.i18nClassInterface.text(i18nClass.getName()));
}
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/Inflector.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/Inflector.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/Inflector.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -26,7 +26,7 @@
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
/**
* Transforms words to singular, plural, humanized (human readable), underscore, camel
case, or ordinal form. This is inspired by
@@ -469,8 +469,8 @@
public void addIrregular( String singular,
String plural ) {
- ArgCheck.isNotEmpty(singular, "singular rule");
- ArgCheck.isNotEmpty(plural, "plural rule");
+ CheckArg.isNotEmpty(singular, "singular rule");
+ CheckArg.isNotEmpty(plural, "plural rule");
String singularRemainder = singular.length() > 1 ? singular.substring(1) :
"";
String pluralRemainder = plural.length() > 1 ? plural.substring(1) :
"";
addPluralize("(" + singular.charAt(0) + ")" +
singularRemainder + "$", "$1" + pluralRemainder);
Deleted: trunk/dna-common/src/main/java/org/jboss/dna/common/util/ArgCheck.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/ArgCheck.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/ArgCheck.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -1,788 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.common.util;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import org.jboss.dna.common.CommonI18n;
-
-/**
- * Utility class that checks arguments to methods. This class is to be used only in API
methods, where failure to supply correct
- * arguments should result in a useful error message. In all cases, use the
<code>assert</code> statement.
- */
-public final class ArgCheck {
-
- // ########################## int METHODS ###################################
-
- /**
- * Check that the argument is not less than the supplied value
- *
- * @param argument The argument
- * @param notLessThanValue the value that is to be used to check the value
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument greater than or equal to the supplied
vlaue
- */
- public static void isNotLessThan( int argument,
- int notLessThanValue,
- String name ) {
- if (argument < notLessThanValue) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeLessThan.text(name, argument,
notLessThanValue));
- }
- }
-
- /**
- * Check that the argument is not greater than the supplied value
- *
- * @param argument The argument
- * @param notGreaterThanValue the value that is to be used to check the value
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is less than or equal to the supplied
value
- */
- public static void isNotGreaterThan( int argument,
- int notGreaterThanValue,
- String name ) {
- if (argument > notGreaterThanValue) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeGreaterThan.text(name, argument,
notGreaterThanValue));
- }
- }
-
- /**
- * Check that the argument is greater than the supplied value
- *
- * @param argument The argument
- * @param greaterThanValue the value that is to be used to check the value
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is not greater than the supplied
value
- */
- public static void isGreaterThan( int argument,
- int greaterThanValue,
- String name ) {
- if (argument <= greaterThanValue) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeGreaterThan.text(name, argument,
greaterThanValue));
- }
- }
-
- /**
- * Check that the argument is less than the supplied value
- *
- * @param argument The argument
- * @param lessThanValue the value that is to be used to check the value
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is not less than the supplied value
- */
- public static void isLessThan( int argument,
- int lessThanValue,
- String name ) {
- if (argument >= lessThanValue) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeLessThan.text(name, argument,
lessThanValue));
- }
- }
-
- /**
- * Check that the argument is greater than or equal to the supplied value
- *
- * @param argument The argument
- * @param greaterThanOrEqualToValue the value that is to be used to check the value
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is not greater than or equal to the
supplied value
- */
- public static void isGreaterThanOrEqualTo( int argument,
- int greaterThanOrEqualToValue,
- String name ) {
- if (argument < greaterThanOrEqualToValue) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeGreaterThanOrEqualTo.text(name,
-
argument,
-
greaterThanOrEqualToValue));
- }
- }
-
- /**
- * Check that the argument is less than or equal to the supplied value
- *
- * @param argument The argument
- * @param lessThanOrEqualToValue the value that is to be used to check the value
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is not less than or equal to the
supplied value
- */
- public static void isLessThanOrEqualTo( int argument,
- int lessThanOrEqualToValue,
- String name ) {
- if (argument > lessThanOrEqualToValue) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeLessThanOrEqualTo.text(name,
-
argument,
-
lessThanOrEqualToValue));
- }
- }
-
- /**
- * Check that the argument is non-negative (>=0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is negative (<0)
- */
- public static void isNonNegative( int argument,
- String name ) {
- if (argument < 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNegative.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is non-positive (<=0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is positive (>0)
- */
- public static void isNonPositive( int argument,
- String name ) {
- if (argument > 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBePositive.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is negative (<0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is non-negative (>=0)
- */
- public static void isNegative( int argument,
- String name ) {
- if (argument >= 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeNegative.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is positive (>0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is non-positive (<=0)
- */
- public static void isPositive( int argument,
- String name ) {
- if (argument <= 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBePositive.text(name, argument));
- }
- }
-
- // ########################## long METHODS ###################################
-
- /**
- * Check that the argument is non-negative (>=0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is negative (<0)
- */
- public static void isNonNegative( long argument,
- String name ) {
- if (argument < 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNegative.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is non-positive (<=0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is positive (>0)
- */
- public static void isNonPositive( long argument,
- String name ) {
- if (argument > 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBePositive.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is negative (<0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is non-negative (>=0)
- */
- public static void isNegative( long argument,
- String name ) {
- if (argument >= 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeNegative.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is positive (>0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is non-positive (<=0)
- */
- public static void isPositive( long argument,
- String name ) {
- if (argument <= 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBePositive.text(name, argument));
- }
- }
-
- // ########################## double METHODS ###################################
-
- /**
- * Check that the argument is non-negative (>=0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is negative (<0)
- */
- public static void isNonNegative( double argument,
- String name ) {
- if (argument < 0.0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNegative.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is non-positive (<=0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is positive (>0)
- */
- public static void isNonPositive( double argument,
- String name ) {
- if (argument > 0.0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBePositive.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is negative (<0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is non-negative (>=0)
- */
- public static void isNegative( double argument,
- String name ) {
- if (argument >= 0.0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeNegative.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is positive (>0).
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is non-positive (<=0)
- */
- public static void isPositive( double argument,
- String name ) {
- if (argument <= 0.0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBePositive.text(name, argument));
- }
- }
-
- /**
- * Check that the argument is not NaN.
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is NaN
- */
- public static void isNotNan( double argument,
- String name ) {
- if (Double.isNaN(argument)) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeNumber.text(name));
- }
- }
-
- // ########################## String METHODS ###################################
-
- /**
- * Check that the string is non-null and has length > 0
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If value is null or length == 0
- */
- public static void isNotZeroLength( String argument,
- String name ) {
- isNotNull(argument, name);
- if (argument.length() <= 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNullOrZeroLength.text(name));
- }
- }
-
- /**
- * Check that the string is not empty, is not null, and does not contain only
whitespace.
- *
- * @param argument String
- * @param name The name of the argument
- * @throws IllegalArgumentException If string is null or empty
- */
- public static void isNotEmpty( String argument,
- String name ) {
- isNotZeroLength(argument, name);
- if (argument != null && argument.trim().length() == 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNullOrZeroLengthOrEmpty.text(name));
- }
- }
-
- // ########################## Object METHODS ###################################
-
- /**
- * Check that the specified argument is non-null
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If argument is null
- */
- public static void isNotNull( Object argument,
- String name ) {
- if (argument == null) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNull.text(name));
- }
- }
-
- /**
- * Returns the specified argument if it is not <code>null</code>.
- *
- * @param <T>
- * @param argument The argument
- * @param name The name of the argument
- * @return The argument
- * @throws IllegalArgumentException If argument is <code>null</code>
- */
- public static <T> T getNotNull( T argument,
- String name ) {
- isNotNull(argument, name);
- return argument;
- }
-
- /**
- * Check that the argument is null
- *
- * @param argument The argument
- * @param name The name of the argument
- * @throws IllegalArgumentException If value is non-null
- */
- public static void isNull( Object argument,
- String name ) {
- if (argument != null) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeNull.text(name));
- }
- }
-
- /**
- * Check that the object is an instance of the specified Class
- *
- * @param argument Value
- * @param expectedClass Class
- * @param name The name of the argument
- * @throws IllegalArgumentException If value is null
- */
- public static void isInstanceOf( Object argument,
- Class<?> expectedClass,
- String name ) {
- isNotNull(argument, name);
- if (!expectedClass.isInstance(argument)) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeInstanceOf.text(name,
-
argument.getClass(),
-
expectedClass.getName()));
- }
- }
-
- /**
- * Checks that the object is an instance of the specified Class and then returns the
object cast to the specified Class
- *
- * @param <C> the class type
- * @param argument Value
- * @param expectedClass Class
- * @param name The name of the argument
- * @return value cast to the specified Class
- * @throws IllegalArgumentException If value is not an instance of theClass.
- */
- // due to cast in return
- public static <C> C getInstanceOf( Object argument,
- Class<C> expectedClass,
- String name ) {
- isInstanceOf(argument, expectedClass, name);
- return expectedClass.cast(argument);
- }
-
- /**
- * Asserts that the specified first object is the same as (==) the specified second
object.
- *
- * @param <T>
- * @param argument The argument to assert as the same as
<code>object</code>.
- * @param argumentName The name that will be used within the exception message for
the argument should an exception be thrown
- * @param object The object to assert as the same as
<code>argument</code>.
- * @param objectName The name that will be used within the exception message for
<code>object</code> should an exception be
- * thrown; if <code>null</code> and
<code>object</code> is not <code>null</code>,
<code>object.toString()</code> will
- * be used.
- * @throws IllegalArgumentException If the specified objects are not the same.
- */
- public static <T> void isSame( final T argument,
- String argumentName,
- final T object,
- String objectName ) {
- if (argument != object) {
- if (objectName == null) objectName = getObjectName(object);
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeSameAs.text(argumentName, objectName));
- }
- }
-
- /**
- * Asserts that the specified first object is not the same as (==) the specified
second object.
- *
- * @param <T>
- * @param argument The argument to assert as not the same as
<code>object</code>.
- * @param argumentName The name that will be used within the exception message for
the argument should an exception be thrown
- * @param object The object to assert as not the same as
<code>argument</code>.
- * @param objectName The name that will be used within the exception message for
<code>object</code> should an exception be
- * thrown; if <code>null</code> and
<code>object</code> is not <code>null</code>,
<code>object.toString()</code> will
- * be used.
- * @throws IllegalArgumentException If the specified objects are the same.
- */
- public static <T> void isNotSame( final T argument,
- String argumentName,
- final T object,
- String objectName ) {
- if (argument == object) {
- if (objectName == null) objectName = getObjectName(object);
- throw new
IllegalArgumentException(CommonI18n.argumentMustNotBeSameAs.text(argumentName,
objectName));
- }
- }
-
- /**
- * Asserts that the specified first object is {@link Object#equals(Object) equal to}
the specified second object.
- *
- * @param <T>
- * @param argument The argument to assert equal to <code>object</code>.
- * @param argumentName The name that will be used within the exception message for
the argument should an exception be thrown
- * @param object The object to assert as equal to <code>argument</code>.
- * @param objectName The name that will be used within the exception message for
<code>object</code> should an exception be
- * thrown; if <code>null</code> and
<code>object</code> is not <code>null</code>,
<code>object.toString()</code> will
- * be used.
- * @throws IllegalArgumentException If the specified objects are not equal.
- */
- public static <T> void isEquals( final T argument,
- String argumentName,
- final T object,
- String objectName ) {
- if (!argument.equals(object)) {
- if (objectName == null) objectName = getObjectName(object);
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeEquals.text(argumentName, objectName));
- }
- }
-
- /**
- * Asserts that the specified first object is not {@link Object#equals(Object) equal
to} the specified second object.
- *
- * @param <T>
- * @param argument The argument to assert equal to <code>object</code>.
- * @param argumentName The name that will be used within the exception message for
the argument should an exception be thrown
- * @param object The object to assert as equal to <code>argument</code>.
- * @param objectName The name that will be used within the exception message for
<code>object</code> should an exception be
- * thrown; if <code>null</code> and
<code>object</code> is not <code>null</code>,
<code>object.toString()</code> will
- * be used.
- * @throws IllegalArgumentException If the specified objects are equals.
- */
- public static <T> void isNotEquals( final T argument,
- String argumentName,
- final T object,
- String objectName ) {
- if (argument.equals(object)) {
- if (objectName == null) objectName = getObjectName(object);
- throw new
IllegalArgumentException(CommonI18n.argumentMustNotBeEquals.text(argumentName,
objectName));
- }
- }
-
- // ########################## ITERATOR METHODS ###################################
-
- /**
- * Checks that the iterator is not empty, and throws an exception if it is.
- *
- * @param argument the iterator to check
- * @param name The name of the argument
- * @throws IllegalArgumentException If iterator is empty (i.e., iterator.hasNext()
returns false)
- */
- public static void isNotEmpty( Iterator<?> argument,
- String name ) {
- isNotNull(argument, name);
- if (!argument.hasNext()) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text(name));
- }
- }
-
- // ########################## COLLECTION METHODS ###################################
-
- /**
- * Check that the collection is not empty
- *
- * @param argument Collection
- * @param name The name of the argument
- * @throws IllegalArgumentException If collection is null or empty
- */
- public static void isNotEmpty( Collection<?> argument,
- String name ) {
- isNotNull(argument, name);
- if (argument.isEmpty()) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text(name));
- }
- }
-
- /**
- * Check that the map is not empty
- *
- * @param argument Map
- * @param name The name of the argument
- * @throws IllegalArgumentException If map is null or empty
- */
- public static void isNotEmpty( Map<?, ?> argument,
- String name ) {
- isNotNull(argument, name);
- if (argument.isEmpty()) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text(name));
- }
- }
-
- /**
- * Check that the array is not empty
- *
- * @param argument Array
- * @param name The name of the argument
- * @throws IllegalArgumentException If array is null or empty
- */
- public static void isNotEmpty( Object[] argument,
- String name ) {
- isNotNull(argument, name);
- if (argument.length == 0) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text(name));
- }
- }
-
- protected static String getObjectName( Object obj ) {
- return obj == null ? null : "'" + obj.toString() +
"'";
- }
-
- /**
- * Check that the collection contains the value
- *
- * @param argument Collection to check
- * @param value Value to check for, may be null
- * @param name The name of the argument
- * @throws IllegalArgumentException If collection is null or doesn't contain
value
- */
- public static void contains( Collection<?> argument,
- Object value,
- String name ) {
- isNotNull(argument, name);
- if (!argument.contains(value)) {
- throw new
IllegalArgumentException(CommonI18n.argumentDidNotContainObject.text(name,
getObjectName(value)));
- }
- }
-
- /**
- * Check that the map contains the key
- *
- * @param argument Map to check
- * @param key Key to check for, may be null
- * @param name The name of the argument
- * @throws IllegalArgumentException If map is null or doesn't contain key
- */
- public static void containsKey( Map<?, ?> argument,
- Object key,
- String name ) {
- isNotNull(argument, name);
- if (!argument.containsKey(key)) {
- throw new
IllegalArgumentException(CommonI18n.argumentDidNotContainKey.text(name,
getObjectName(key)));
- }
- }
-
- /**
- * Check that the collection is not null and contains no nulls
- *
- * @param argument Array
- * @param name The name of the argument
- * @throws IllegalArgumentException If array is null or has null values
- */
- public static void containsNoNulls( Iterable<?> argument,
- String name ) {
- isNotNull(argument, name);
- int i = 0;
- for (Object object : argument) {
- if (object == null) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotContainNullValue.text(name, i));
- }
- ++i;
- }
- }
-
- /**
- * Check that the array is not null and contains no nulls
- *
- * @param argument Array
- * @param name The name of the argument
- * @throws IllegalArgumentException If array is null or has null values
- */
- public static void containsNoNulls( Object[] argument,
- String name ) {
- isNotNull(argument, name);
- int i = 0;
- for (Object object : argument) {
- if (object == null) {
- throw new
IllegalArgumentException(CommonI18n.argumentMayNotContainNullValue.text(name, i));
- }
- ++i;
- }
- }
-
- /**
- * Check that the collection contains at least the supplied number of elements
- *
- * @param argument Collection
- * @param minimumSize the minimum size
- * @param name The name of the argument
- * @throws IllegalArgumentException If collection has a size smaller than the
supplied value
- */
- public static void hasSizeOfAtLeast( Collection<?> argument,
- int minimumSize,
- String name ) {
- isNotNull(argument, name);
- if (argument.size() < minimumSize) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
-
Collection.class.getSimpleName(),
-
argument.size(),
-
minimumSize));
- }
- }
-
- /**
- * Check that the collection contains no more than the supplied number of elements
- *
- * @param argument Collection
- * @param maximumSize the maximum size
- * @param name The name of the argument
- * @throws IllegalArgumentException If collection has a size smaller than the
supplied value
- */
- public static void hasSizeOfAtMost( Collection<?> argument,
- int maximumSize,
- String name ) {
- isNotNull(argument, name);
- if (argument.size() > maximumSize) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
-
Collection.class.getSimpleName(),
-
argument.size(),
-
maximumSize));
- }
- }
-
- /**
- * Check that the map contains at least the supplied number of entries
- *
- * @param argument the map
- * @param minimumSize the minimum size
- * @param name The name of the argument
- * @throws IllegalArgumentException If the map has a size smaller than the supplied
value
- */
- public static void hasSizeOfAtLeast( Map<?, ?> argument,
- int minimumSize,
- String name ) {
- isNotNull(argument, name);
- if (argument.size() < minimumSize) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
-
Map.class.getSimpleName(),
-
argument.size(),
-
minimumSize));
- }
- }
-
- /**
- * Check that the map contains no more than the supplied number of entries
- *
- * @param argument the map
- * @param maximumSize the maximum size
- * @param name The name of the argument
- * @throws IllegalArgumentException If the map has a size smaller than the supplied
value
- */
- public static void hasSizeOfAtMost( Map<?, ?> argument,
- int maximumSize,
- String name ) {
- isNotNull(argument, name);
- if (argument.size() > maximumSize) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
-
Map.class.getSimpleName(),
-
argument.size(),
-
maximumSize));
- }
- }
-
- /**
- * Check that the array contains at least the supplied number of elements
- *
- * @param argument the array
- * @param minimumSize the minimum size
- * @param name The name of the argument
- * @throws IllegalArgumentException If the array has a size smaller than the supplied
value
- */
- public static void hasSizeOfAtLeast( Object[] argument,
- int minimumSize,
- String name ) {
- isNotNull(argument, name);
- if (argument.length < minimumSize) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
-
Object[].class.getSimpleName(),
-
argument.length,
-
minimumSize));
- }
- }
-
- /**
- * Check that the array contains no more than the supplied number of elements
- *
- * @param argument the array
- * @param maximumSize the maximum size
- * @param name The name of the argument
- * @throws IllegalArgumentException If the array has a size smaller than the supplied
value
- */
- public static void hasSizeOfAtMost( Object[] argument,
- int maximumSize,
- String name ) {
- isNotNull(argument, name);
- if (argument.length > maximumSize) {
- throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
-
Object[].class.getSimpleName(),
-
argument.length,
-
maximumSize));
- }
- }
-
- private ArgCheck() {
- // prevent construction
- }
-}
Copied: trunk/dna-common/src/main/java/org/jboss/dna/common/util/CheckArg.java (from rev
532, trunk/dna-common/src/main/java/org/jboss/dna/common/util/ArgCheck.java)
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/CheckArg.java
(rev 0)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/CheckArg.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -0,0 +1,788 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.dna.common.util;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import org.jboss.dna.common.CommonI18n;
+
+/**
+ * Utility class that checks arguments to methods. This class is to be used only in API
methods, where failure to supply correct
+ * arguments should result in a useful error message. In all cases, use the
<code>assert</code> statement.
+ */
+public final class CheckArg {
+
+ // ########################## int METHODS ###################################
+
+ /**
+ * Check that the argument is not less than the supplied value
+ *
+ * @param argument The argument
+ * @param notLessThanValue the value that is to be used to check the value
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument greater than or equal to the supplied
vlaue
+ */
+ public static void isNotLessThan( int argument,
+ int notLessThanValue,
+ String name ) {
+ if (argument < notLessThanValue) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeLessThan.text(name, argument,
notLessThanValue));
+ }
+ }
+
+ /**
+ * Check that the argument is not greater than the supplied value
+ *
+ * @param argument The argument
+ * @param notGreaterThanValue the value that is to be used to check the value
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is less than or equal to the supplied
value
+ */
+ public static void isNotGreaterThan( int argument,
+ int notGreaterThanValue,
+ String name ) {
+ if (argument > notGreaterThanValue) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeGreaterThan.text(name, argument,
notGreaterThanValue));
+ }
+ }
+
+ /**
+ * Check that the argument is greater than the supplied value
+ *
+ * @param argument The argument
+ * @param greaterThanValue the value that is to be used to check the value
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is not greater than the supplied
value
+ */
+ public static void isGreaterThan( int argument,
+ int greaterThanValue,
+ String name ) {
+ if (argument <= greaterThanValue) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeGreaterThan.text(name, argument,
greaterThanValue));
+ }
+ }
+
+ /**
+ * Check that the argument is less than the supplied value
+ *
+ * @param argument The argument
+ * @param lessThanValue the value that is to be used to check the value
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is not less than the supplied value
+ */
+ public static void isLessThan( int argument,
+ int lessThanValue,
+ String name ) {
+ if (argument >= lessThanValue) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeLessThan.text(name, argument,
lessThanValue));
+ }
+ }
+
+ /**
+ * Check that the argument is greater than or equal to the supplied value
+ *
+ * @param argument The argument
+ * @param greaterThanOrEqualToValue the value that is to be used to check the value
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is not greater than or equal to the
supplied value
+ */
+ public static void isGreaterThanOrEqualTo( int argument,
+ int greaterThanOrEqualToValue,
+ String name ) {
+ if (argument < greaterThanOrEqualToValue) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeGreaterThanOrEqualTo.text(name,
+
argument,
+
greaterThanOrEqualToValue));
+ }
+ }
+
+ /**
+ * Check that the argument is less than or equal to the supplied value
+ *
+ * @param argument The argument
+ * @param lessThanOrEqualToValue the value that is to be used to check the value
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is not less than or equal to the
supplied value
+ */
+ public static void isLessThanOrEqualTo( int argument,
+ int lessThanOrEqualToValue,
+ String name ) {
+ if (argument > lessThanOrEqualToValue) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeLessThanOrEqualTo.text(name,
+
argument,
+
lessThanOrEqualToValue));
+ }
+ }
+
+ /**
+ * Check that the argument is non-negative (>=0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is negative (<0)
+ */
+ public static void isNonNegative( int argument,
+ String name ) {
+ if (argument < 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNegative.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is non-positive (<=0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is positive (>0)
+ */
+ public static void isNonPositive( int argument,
+ String name ) {
+ if (argument > 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBePositive.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is negative (<0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is non-negative (>=0)
+ */
+ public static void isNegative( int argument,
+ String name ) {
+ if (argument >= 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeNegative.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is positive (>0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is non-positive (<=0)
+ */
+ public static void isPositive( int argument,
+ String name ) {
+ if (argument <= 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBePositive.text(name, argument));
+ }
+ }
+
+ // ########################## long METHODS ###################################
+
+ /**
+ * Check that the argument is non-negative (>=0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is negative (<0)
+ */
+ public static void isNonNegative( long argument,
+ String name ) {
+ if (argument < 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNegative.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is non-positive (<=0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is positive (>0)
+ */
+ public static void isNonPositive( long argument,
+ String name ) {
+ if (argument > 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBePositive.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is negative (<0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is non-negative (>=0)
+ */
+ public static void isNegative( long argument,
+ String name ) {
+ if (argument >= 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeNegative.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is positive (>0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is non-positive (<=0)
+ */
+ public static void isPositive( long argument,
+ String name ) {
+ if (argument <= 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBePositive.text(name, argument));
+ }
+ }
+
+ // ########################## double METHODS ###################################
+
+ /**
+ * Check that the argument is non-negative (>=0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is negative (<0)
+ */
+ public static void isNonNegative( double argument,
+ String name ) {
+ if (argument < 0.0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNegative.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is non-positive (<=0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is positive (>0)
+ */
+ public static void isNonPositive( double argument,
+ String name ) {
+ if (argument > 0.0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBePositive.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is negative (<0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is non-negative (>=0)
+ */
+ public static void isNegative( double argument,
+ String name ) {
+ if (argument >= 0.0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeNegative.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is positive (>0).
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is non-positive (<=0)
+ */
+ public static void isPositive( double argument,
+ String name ) {
+ if (argument <= 0.0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBePositive.text(name, argument));
+ }
+ }
+
+ /**
+ * Check that the argument is not NaN.
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is NaN
+ */
+ public static void isNotNan( double argument,
+ String name ) {
+ if (Double.isNaN(argument)) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeNumber.text(name));
+ }
+ }
+
+ // ########################## String METHODS ###################################
+
+ /**
+ * Check that the string is non-null and has length > 0
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If value is null or length == 0
+ */
+ public static void isNotZeroLength( String argument,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.length() <= 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNullOrZeroLength.text(name));
+ }
+ }
+
+ /**
+ * Check that the string is not empty, is not null, and does not contain only
whitespace.
+ *
+ * @param argument String
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If string is null or empty
+ */
+ public static void isNotEmpty( String argument,
+ String name ) {
+ isNotZeroLength(argument, name);
+ if (argument != null && argument.trim().length() == 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNullOrZeroLengthOrEmpty.text(name));
+ }
+ }
+
+ // ########################## Object METHODS ###################################
+
+ /**
+ * Check that the specified argument is non-null
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If argument is null
+ */
+ public static void isNotNull( Object argument,
+ String name ) {
+ if (argument == null) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeNull.text(name));
+ }
+ }
+
+ /**
+ * Returns the specified argument if it is not <code>null</code>.
+ *
+ * @param <T>
+ * @param argument The argument
+ * @param name The name of the argument
+ * @return The argument
+ * @throws IllegalArgumentException If argument is <code>null</code>
+ */
+ public static <T> T getNotNull( T argument,
+ String name ) {
+ isNotNull(argument, name);
+ return argument;
+ }
+
+ /**
+ * Check that the argument is null
+ *
+ * @param argument The argument
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If value is non-null
+ */
+ public static void isNull( Object argument,
+ String name ) {
+ if (argument != null) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeNull.text(name));
+ }
+ }
+
+ /**
+ * Check that the object is an instance of the specified Class
+ *
+ * @param argument Value
+ * @param expectedClass Class
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If value is null
+ */
+ public static void isInstanceOf( Object argument,
+ Class<?> expectedClass,
+ String name ) {
+ isNotNull(argument, name);
+ if (!expectedClass.isInstance(argument)) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeInstanceOf.text(name,
+
argument.getClass(),
+
expectedClass.getName()));
+ }
+ }
+
+ /**
+ * Checks that the object is an instance of the specified Class and then returns the
object cast to the specified Class
+ *
+ * @param <C> the class type
+ * @param argument Value
+ * @param expectedClass Class
+ * @param name The name of the argument
+ * @return value cast to the specified Class
+ * @throws IllegalArgumentException If value is not an instance of theClass.
+ */
+ // due to cast in return
+ public static <C> C getInstanceOf( Object argument,
+ Class<C> expectedClass,
+ String name ) {
+ isInstanceOf(argument, expectedClass, name);
+ return expectedClass.cast(argument);
+ }
+
+ /**
+ * Asserts that the specified first object is the same as (==) the specified second
object.
+ *
+ * @param <T>
+ * @param argument The argument to assert as the same as
<code>object</code>.
+ * @param argumentName The name that will be used within the exception message for
the argument should an exception be thrown
+ * @param object The object to assert as the same as
<code>argument</code>.
+ * @param objectName The name that will be used within the exception message for
<code>object</code> should an exception be
+ * thrown; if <code>null</code> and
<code>object</code> is not <code>null</code>,
<code>object.toString()</code> will
+ * be used.
+ * @throws IllegalArgumentException If the specified objects are not the same.
+ */
+ public static <T> void isSame( final T argument,
+ String argumentName,
+ final T object,
+ String objectName ) {
+ if (argument != object) {
+ if (objectName == null) objectName = getObjectName(object);
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeSameAs.text(argumentName, objectName));
+ }
+ }
+
+ /**
+ * Asserts that the specified first object is not the same as (==) the specified
second object.
+ *
+ * @param <T>
+ * @param argument The argument to assert as not the same as
<code>object</code>.
+ * @param argumentName The name that will be used within the exception message for
the argument should an exception be thrown
+ * @param object The object to assert as not the same as
<code>argument</code>.
+ * @param objectName The name that will be used within the exception message for
<code>object</code> should an exception be
+ * thrown; if <code>null</code> and
<code>object</code> is not <code>null</code>,
<code>object.toString()</code> will
+ * be used.
+ * @throws IllegalArgumentException If the specified objects are the same.
+ */
+ public static <T> void isNotSame( final T argument,
+ String argumentName,
+ final T object,
+ String objectName ) {
+ if (argument == object) {
+ if (objectName == null) objectName = getObjectName(object);
+ throw new
IllegalArgumentException(CommonI18n.argumentMustNotBeSameAs.text(argumentName,
objectName));
+ }
+ }
+
+ /**
+ * Asserts that the specified first object is {@link Object#equals(Object) equal to}
the specified second object.
+ *
+ * @param <T>
+ * @param argument The argument to assert equal to <code>object</code>.
+ * @param argumentName The name that will be used within the exception message for
the argument should an exception be thrown
+ * @param object The object to assert as equal to <code>argument</code>.
+ * @param objectName The name that will be used within the exception message for
<code>object</code> should an exception be
+ * thrown; if <code>null</code> and
<code>object</code> is not <code>null</code>,
<code>object.toString()</code> will
+ * be used.
+ * @throws IllegalArgumentException If the specified objects are not equal.
+ */
+ public static <T> void isEquals( final T argument,
+ String argumentName,
+ final T object,
+ String objectName ) {
+ if (!argument.equals(object)) {
+ if (objectName == null) objectName = getObjectName(object);
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeEquals.text(argumentName, objectName));
+ }
+ }
+
+ /**
+ * Asserts that the specified first object is not {@link Object#equals(Object) equal
to} the specified second object.
+ *
+ * @param <T>
+ * @param argument The argument to assert equal to <code>object</code>.
+ * @param argumentName The name that will be used within the exception message for
the argument should an exception be thrown
+ * @param object The object to assert as equal to <code>argument</code>.
+ * @param objectName The name that will be used within the exception message for
<code>object</code> should an exception be
+ * thrown; if <code>null</code> and
<code>object</code> is not <code>null</code>,
<code>object.toString()</code> will
+ * be used.
+ * @throws IllegalArgumentException If the specified objects are equals.
+ */
+ public static <T> void isNotEquals( final T argument,
+ String argumentName,
+ final T object,
+ String objectName ) {
+ if (argument.equals(object)) {
+ if (objectName == null) objectName = getObjectName(object);
+ throw new
IllegalArgumentException(CommonI18n.argumentMustNotBeEquals.text(argumentName,
objectName));
+ }
+ }
+
+ // ########################## ITERATOR METHODS ###################################
+
+ /**
+ * Checks that the iterator is not empty, and throws an exception if it is.
+ *
+ * @param argument the iterator to check
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If iterator is empty (i.e., iterator.hasNext()
returns false)
+ */
+ public static void isNotEmpty( Iterator<?> argument,
+ String name ) {
+ isNotNull(argument, name);
+ if (!argument.hasNext()) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text(name));
+ }
+ }
+
+ // ########################## COLLECTION METHODS ###################################
+
+ /**
+ * Check that the collection is not empty
+ *
+ * @param argument Collection
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If collection is null or empty
+ */
+ public static void isNotEmpty( Collection<?> argument,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.isEmpty()) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text(name));
+ }
+ }
+
+ /**
+ * Check that the map is not empty
+ *
+ * @param argument Map
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If map is null or empty
+ */
+ public static void isNotEmpty( Map<?, ?> argument,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.isEmpty()) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text(name));
+ }
+ }
+
+ /**
+ * Check that the array is not empty
+ *
+ * @param argument Array
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If array is null or empty
+ */
+ public static void isNotEmpty( Object[] argument,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.length == 0) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text(name));
+ }
+ }
+
+ protected static String getObjectName( Object obj ) {
+ return obj == null ? null : "'" + obj.toString() +
"'";
+ }
+
+ /**
+ * Check that the collection contains the value
+ *
+ * @param argument Collection to check
+ * @param value Value to check for, may be null
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If collection is null or doesn't contain
value
+ */
+ public static void contains( Collection<?> argument,
+ Object value,
+ String name ) {
+ isNotNull(argument, name);
+ if (!argument.contains(value)) {
+ throw new
IllegalArgumentException(CommonI18n.argumentDidNotContainObject.text(name,
getObjectName(value)));
+ }
+ }
+
+ /**
+ * Check that the map contains the key
+ *
+ * @param argument Map to check
+ * @param key Key to check for, may be null
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If map is null or doesn't contain key
+ */
+ public static void containsKey( Map<?, ?> argument,
+ Object key,
+ String name ) {
+ isNotNull(argument, name);
+ if (!argument.containsKey(key)) {
+ throw new
IllegalArgumentException(CommonI18n.argumentDidNotContainKey.text(name,
getObjectName(key)));
+ }
+ }
+
+ /**
+ * Check that the collection is not null and contains no nulls
+ *
+ * @param argument Array
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If array is null or has null values
+ */
+ public static void containsNoNulls( Iterable<?> argument,
+ String name ) {
+ isNotNull(argument, name);
+ int i = 0;
+ for (Object object : argument) {
+ if (object == null) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotContainNullValue.text(name, i));
+ }
+ ++i;
+ }
+ }
+
+ /**
+ * Check that the array is not null and contains no nulls
+ *
+ * @param argument Array
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If array is null or has null values
+ */
+ public static void containsNoNulls( Object[] argument,
+ String name ) {
+ isNotNull(argument, name);
+ int i = 0;
+ for (Object object : argument) {
+ if (object == null) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMayNotContainNullValue.text(name, i));
+ }
+ ++i;
+ }
+ }
+
+ /**
+ * Check that the collection contains at least the supplied number of elements
+ *
+ * @param argument Collection
+ * @param minimumSize the minimum size
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If collection has a size smaller than the
supplied value
+ */
+ public static void hasSizeOfAtLeast( Collection<?> argument,
+ int minimumSize,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.size() < minimumSize) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
+
Collection.class.getSimpleName(),
+
argument.size(),
+
minimumSize));
+ }
+ }
+
+ /**
+ * Check that the collection contains no more than the supplied number of elements
+ *
+ * @param argument Collection
+ * @param maximumSize the maximum size
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If collection has a size smaller than the
supplied value
+ */
+ public static void hasSizeOfAtMost( Collection<?> argument,
+ int maximumSize,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.size() > maximumSize) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
+
Collection.class.getSimpleName(),
+
argument.size(),
+
maximumSize));
+ }
+ }
+
+ /**
+ * Check that the map contains at least the supplied number of entries
+ *
+ * @param argument the map
+ * @param minimumSize the minimum size
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If the map has a size smaller than the supplied
value
+ */
+ public static void hasSizeOfAtLeast( Map<?, ?> argument,
+ int minimumSize,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.size() < minimumSize) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
+
Map.class.getSimpleName(),
+
argument.size(),
+
minimumSize));
+ }
+ }
+
+ /**
+ * Check that the map contains no more than the supplied number of entries
+ *
+ * @param argument the map
+ * @param maximumSize the maximum size
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If the map has a size smaller than the supplied
value
+ */
+ public static void hasSizeOfAtMost( Map<?, ?> argument,
+ int maximumSize,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.size() > maximumSize) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
+
Map.class.getSimpleName(),
+
argument.size(),
+
maximumSize));
+ }
+ }
+
+ /**
+ * Check that the array contains at least the supplied number of elements
+ *
+ * @param argument the array
+ * @param minimumSize the minimum size
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If the array has a size smaller than the supplied
value
+ */
+ public static void hasSizeOfAtLeast( Object[] argument,
+ int minimumSize,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.length < minimumSize) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
+
Object[].class.getSimpleName(),
+
argument.length,
+
minimumSize));
+ }
+ }
+
+ /**
+ * Check that the array contains no more than the supplied number of elements
+ *
+ * @param argument the array
+ * @param maximumSize the maximum size
+ * @param name The name of the argument
+ * @throws IllegalArgumentException If the array has a size smaller than the supplied
value
+ */
+ public static void hasSizeOfAtMost( Object[] argument,
+ int maximumSize,
+ String name ) {
+ isNotNull(argument, name);
+ if (argument.length > maximumSize) {
+ throw new
IllegalArgumentException(CommonI18n.argumentMustBeOfMinimumSize.text(name,
+
Object[].class.getSimpleName(),
+
argument.length,
+
maximumSize));
+ }
+ }
+
+ private CheckArg() {
+ // prevent construction
+ }
+}
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/FileUtil.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -71,7 +71,7 @@
* @throws IllegalArgumentException if the file path is null, empty or blank
*/
public static URL convertFileToURL( String filePath ) throws MalformedURLException {
- ArgCheck.isNotEmpty(filePath, "filePath");
+ CheckArg.isNotEmpty(filePath, "filePath");
File file = new File(filePath.trim());
return file.toURI().toURL();
}
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/IoUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/IoUtil.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/IoUtil.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -99,7 +99,7 @@
* @throws IllegalArgumentException if the stream is null
*/
public static void write( String content, OutputStream stream ) throws IOException {
- ArgCheck.isNotNull(stream, "destination stream");
+ CheckArg.isNotNull(stream, "destination stream");
try {
if (content != null) {
byte[] bytes = content.getBytes();
@@ -123,7 +123,7 @@
* @throws IllegalArgumentException if the writer is null
*/
public static void write( String content, Writer writer ) throws IOException {
- ArgCheck.isNotNull(writer, "destination writer");
+ CheckArg.isNotNull(writer, "destination writer");
try {
if (content != null) {
writer.write(content);
@@ -146,7 +146,7 @@
* @throws IllegalArgumentException if the stream is null
*/
public static void write( InputStream input, OutputStream stream ) throws IOException
{
- ArgCheck.isNotNull(stream, "destination stream");
+ CheckArg.isNotNull(stream, "destination stream");
try {
if (input != null) {
byte[] buffer = new byte[1024];
@@ -177,7 +177,7 @@
* @throws IllegalArgumentException if the writer is null
*/
public static void write( Reader input, Writer writer ) throws IOException {
- ArgCheck.isNotNull(writer, "destination writer");
+ CheckArg.isNotNull(writer, "destination writer");
try {
if (input != null) {
char[] buffer = new char[1024];
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/Reflection.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/Reflection.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/Reflection.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -205,7 +205,7 @@
* @throws IllegalArgumentException if the target class is null
*/
public Reflection( Class<?> targetClass ) {
- ArgCheck.isNotNull(targetClass, "targetClass");
+ CheckArg.isNotNull(targetClass, "targetClass");
this.targetClass = targetClass;
}
Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/util/StringUtil.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -79,7 +79,7 @@
*/
public static String createString( String pattern,
Object... parameters ) {
- ArgCheck.isNotNull(pattern, "pattern");
+ CheckArg.isNotNull(pattern, "pattern");
if (parameters == null) parameters = EMPTY_STRING_ARRAY;
Matcher matcher = PARAMETER_COUNT_PATTERN.matcher(pattern);
StringBuffer text = new StringBuffer();
@@ -306,7 +306,7 @@
public static String truncate( Object obj,
int maxLength,
String suffix ) {
- ArgCheck.isNonNegative(maxLength, "maxLength");
+ CheckArg.isNonNegative(maxLength, "maxLength");
if (obj == null || maxLength == 0) {
return "";
}
@@ -644,7 +644,7 @@
* @return the normalized text
*/
public static String normalize( String text ) {
- ArgCheck.isNotNull(text, "text");
+ CheckArg.isNotNull(text, "text");
// This could be much more efficient.
return NORMALIZE_PATTERN.matcher(text).replaceAll(" ").trim();
}
Modified: trunk/dna-common/src/test/java/org/jboss/dna/common/util/ArgCheckTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/util/ArgCheckTest.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/util/ArgCheckTest.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -36,174 +36,174 @@
@Test
public void isNonNegativeShouldNotThrowExceptionIfPositiveNumber() {
- ArgCheck.isNonNegative(1, "test");
+ CheckArg.isNonNegative(1, "test");
}
@Test
public void isNonNegativeShouldNotThrowExceptionIfZero() {
- ArgCheck.isNonNegative(0, "test");
+ CheckArg.isNonNegative(0, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNonNegativeShouldThrowExceptionIfNegative() {
- ArgCheck.isNonNegative(-1, "test");
+ CheckArg.isNonNegative(-1, "test");
}
@Test
public void isNonPositiveShouldNotThrowExceptionIfNegativeNumber() {
- ArgCheck.isNonPositive(-1, "test");
+ CheckArg.isNonPositive(-1, "test");
}
@Test
public void isNonPositiveShouldNotThrowExceptionIfZero() {
- ArgCheck.isNonPositive(0, "test");
+ CheckArg.isNonPositive(0, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNonPositiveShouldThrowExceptionIfPositive() {
- ArgCheck.isNonPositive(1, "test");
+ CheckArg.isNonPositive(1, "test");
}
@Test
public void isNegativeShouldNotThrowExceptionIfNegativeNumber() {
- ArgCheck.isNegative(-1, "test");
+ CheckArg.isNegative(-1, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNegativeShouldThrowExceptionIfZero() {
- ArgCheck.isNegative(0, "test");
+ CheckArg.isNegative(0, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNegativeShouldThrowExceptionIfPositive() {
- ArgCheck.isNegative(1, "test");
+ CheckArg.isNegative(1, "test");
}
@Test
public void isPositiveShouldNotThrowExceptionIfPositiveNumber() {
- ArgCheck.isPositive(1, "test");
+ CheckArg.isPositive(1, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isPositiveShouldThrowExceptionIfZero() {
- ArgCheck.isPositive(0, "test");
+ CheckArg.isPositive(0, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isPositiveShouldThrowExceptionIfNegative() {
- ArgCheck.isPositive(-1, "test");
+ CheckArg.isPositive(-1, "test");
}
@Test
public void isNonNegativeLongShouldNotThrowExceptionIfPositiveNumber() {
- ArgCheck.isNonNegative(1l, "test");
+ CheckArg.isNonNegative(1l, "test");
}
@Test
public void isNonNegativeLongShouldNotThrowExceptionIfZero() {
- ArgCheck.isNonNegative(0l, "test");
+ CheckArg.isNonNegative(0l, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNonNegativeLongShouldThrowExceptionIfNegative() {
- ArgCheck.isNonNegative(-1l, "test");
+ CheckArg.isNonNegative(-1l, "test");
}
@Test
public void isNonPositiveLongShouldNotThrowExceptionIfNegativeNumber() {
- ArgCheck.isNonPositive(-1l, "test");
+ CheckArg.isNonPositive(-1l, "test");
}
@Test
public void isNonPositiveLongShouldNotThrowExceptionIfZero() {
- ArgCheck.isNonPositive(0l, "test");
+ CheckArg.isNonPositive(0l, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNonPositiveLongShouldThrowExceptionIfPositive() {
- ArgCheck.isNonPositive(1l, "test");
+ CheckArg.isNonPositive(1l, "test");
}
@Test
public void isNegativeLongShouldNotThrowExceptionIfNegativeNumber() {
- ArgCheck.isNegative(-1l, "test");
+ CheckArg.isNegative(-1l, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNegativeLongShouldThrowExceptionIfZero() {
- ArgCheck.isNegative(0l, "test");
+ CheckArg.isNegative(0l, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNegativeLongShouldThrowExceptionIfPositive() {
- ArgCheck.isNegative(1l, "test");
+ CheckArg.isNegative(1l, "test");
}
@Test
public void isPositiveLongShouldNotThrowExceptionIfPositiveNumber() {
- ArgCheck.isPositive(1l, "test");
+ CheckArg.isPositive(1l, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isPositiveLongShouldThrowExceptionIfZero() {
- ArgCheck.isPositive(0l, "test");
+ CheckArg.isPositive(0l, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isPositiveLongShouldThrowExceptionIfNegative() {
- ArgCheck.isPositive(-1l, "test");
+ CheckArg.isPositive(-1l, "test");
}
@Test
public void
isNotEmptyStringShouldNotThrowExceptionIfGivenStringWithAtLeastOneCharacter() {
- ArgCheck.isNotEmpty("a string", "test");
+ CheckArg.isNotEmpty("a string", "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotEmptyStringShouldThrowExceptionIfGivenNullString() {
- ArgCheck.isNotEmpty((String)null, "test");
+ CheckArg.isNotEmpty((String)null, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotEmptyStringShouldThrowExceptionIfGivenEmptyString() {
- ArgCheck.isNotEmpty("", "test");
+ CheckArg.isNotEmpty("", "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotEmptyStringShouldThrowExceptionIfGivenStringWithOnlyWhitespace() {
- ArgCheck.isNotEmpty("\t\t ", "test");
+ CheckArg.isNotEmpty("\t\t ", "test");
}
@Test
public void
isNotZeroLengthShouldNotThrowExceptionIfGivenAStringOneCharacterOrLonger() {
- ArgCheck.isNotZeroLength("a", "test");
+ CheckArg.isNotZeroLength("a", "test");
}
@Test
public void isNotZeroLengthShouldNotThrowExceptionIfGivenAStringWithOnlyWhitespace()
{
- ArgCheck.isNotZeroLength(" ", "test");
- ArgCheck.isNotZeroLength("\t\t", "test");
+ CheckArg.isNotZeroLength(" ", "test");
+ CheckArg.isNotZeroLength("\t\t", "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotZeroLengthShouldThrowExceptionIfGivenAStringWithNoCharacters() {
- ArgCheck.isNotZeroLength("", "test");
+ CheckArg.isNotZeroLength("", "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotZeroLengthShouldThrowExceptionIfGivenANullString() {
- ArgCheck.isNotZeroLength(null, "test");
+ CheckArg.isNotZeroLength(null, "test");
}
@Test
public void isNotNullShouldNotThrowExceptionIfGivenNonNullReference() {
- ArgCheck.isNotNull("a", "test");
- ArgCheck.isNotNull(new Object(), "test");
+ CheckArg.isNotNull("a", "test");
+ CheckArg.isNotNull(new Object(), "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotNullShouldThrowExceptionIfGivenNullReference() {
- ArgCheck.isNotNull(null, "test");
+ CheckArg.isNotNull(null, "test");
}
@Test
@@ -213,386 +213,386 @@
@Test( expected = IllegalArgumentException.class )
public void getNotNullShouldThrowExceptionIfGivenNullReference() {
- ArgCheck.getNotNull(null, "test");
+ CheckArg.getNotNull(null, "test");
}
@Test
public void isNullShouldNotThrowExceptionIfGivenNullReference() {
- ArgCheck.isNull(null, "test");
+ CheckArg.isNull(null, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNullShouldThrowExceptionIfGivenNonNullReference() {
- ArgCheck.isNull(this, "test");
+ CheckArg.isNull(this, "test");
}
@Test
public void
isInstanceOfShouldNotThrowExceptionIfReferenceIsInstanceOfTheSuppliedClass() {
- ArgCheck.isInstanceOf(this, this.getClass(), "test");
+ CheckArg.isInstanceOf(this, this.getClass(), "test");
}
@Test( expected = IllegalArgumentException.class )
public void
isInstanceOfShouldNotThrowExceptionIfReferenceIsNotInstanceOfTheSuppliedClass() {
- ArgCheck.isInstanceOf(" ", this.getClass(), "test");
+ CheckArg.isInstanceOf(" ", this.getClass(), "test");
}
@Test( expected = IllegalArgumentException.class )
public void isInstanceOfShouldNotThrowExceptionIfReferenceIsNull() {
- ArgCheck.isInstanceOf(null, this.getClass(), "test");
+ CheckArg.isInstanceOf(null, this.getClass(), "test");
}
@Test
public void getInstanceOfShouldReturnCastArgument() {
Object obj = "a";
- ArgCheck.getInstanceOf(obj, String.class, "test").length();
+ CheckArg.getInstanceOf(obj, String.class, "test").length();
}
@Test( expected = IllegalArgumentException.class )
public void getInstanceOfShouldThrowExceptionIfGivenNullReference() {
- ArgCheck.getInstanceOf(null, getClass(), "test");
+ CheckArg.getInstanceOf(null, getClass(), "test");
}
@Test
public void
isNotEmptyCollectionShouldNotThrowExceptionIfGivenCollectionWithAtLeastOneObject() {
- ArgCheck.isNotEmpty(Collections.singletonList(" "), "test");
+ CheckArg.isNotEmpty(Collections.singletonList(" "), "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotEmptyCollectionShouldThrowExceptionIfGivenNullCollection() {
- ArgCheck.isNotEmpty((Collection<?>)null, "test");
+ CheckArg.isNotEmpty((Collection<?>)null, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotEmptyCollectionShouldThrowExceptionIfGivenEmptyCollection() {
- ArgCheck.isNotEmpty(Collections.emptyList(), "test");
+ CheckArg.isNotEmpty(Collections.emptyList(), "test");
}
@Test
public void isNotEmptyMapShouldNotThrowExceptionIfGivenMapWithAtLeastOneEntry() {
- ArgCheck.isNotEmpty(Collections.singletonMap("key", "value"),
"test");
+ CheckArg.isNotEmpty(Collections.singletonMap("key", "value"),
"test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotEmptyMapShouldThrowExceptionIfGivenNullMap() {
- ArgCheck.isNotEmpty((Map<?, ?>)null, "test");
+ CheckArg.isNotEmpty((Map<?, ?>)null, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotEmptyMapShouldThrowExceptionIfGivenEmptyMap() {
- ArgCheck.isNotEmpty(Collections.emptyMap(), "test");
+ CheckArg.isNotEmpty(Collections.emptyMap(), "test");
}
@Test
public void isNotEmptyArrayShouldNotThrowExceptionIfGivenArrayWithAtLeastOneEntry()
{
- ArgCheck.isNotEmpty(new Object[] {"key", "value"},
"test");
+ CheckArg.isNotEmpty(new Object[] {"key", "value"},
"test");
}
@Test
public void isNotEmptyArrayShouldNotThrowExceptionIfGivenArrayWithAtNullEntry() {
- ArgCheck.isNotEmpty(new Object[] {"key", "value", null},
"test");
+ CheckArg.isNotEmpty(new Object[] {"key", "value", null},
"test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotEmptyArrayShouldThrowExceptionIfGivenNullArray() {
- ArgCheck.isNotEmpty((Object[])null, "test");
+ CheckArg.isNotEmpty((Object[])null, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotEmptyArrayShouldThrowExceptionIfGivenEmptyArray() {
- ArgCheck.isNotEmpty(new Object[] {}, "test");
+ CheckArg.isNotEmpty(new Object[] {}, "test");
}
@Test
public void isNotSameShouldNotThrowAnExceptionIfPassedSameObject() {
- ArgCheck.isNotSame("a", "first", "b",
"second");
- ArgCheck.isNotSame(new String("a"), "first", new
String("a"), "second");
+ CheckArg.isNotSame("a", "first", "b",
"second");
+ CheckArg.isNotSame(new String("a"), "first", new
String("a"), "second");
}
@Test
public void isNotSameShouldNotThrowAnExceptionIfPassedSameObjectWithNoNames() {
- ArgCheck.isNotSame("a", null, "b", null);
- ArgCheck.isNotSame(new String("a"), null, new String("a"),
null);
+ CheckArg.isNotSame("a", null, "b", null);
+ CheckArg.isNotSame(new String("a"), null, new String("a"),
null);
}
@Test
public void
isNotSameShouldNotThrowAnExceptionIfPassedNullFirstObjectAndNonNullSecondObject() {
- ArgCheck.isNotSame(null, "first", "b", "second");
+ CheckArg.isNotSame(null, "first", "b", "second");
}
@Test
public void
isNotSameShouldNotThrowAnExceptionIfPassedNonNullFirstObjectAndNullSecondObject() {
- ArgCheck.isNotSame("a", "first", null, "second");
+ CheckArg.isNotSame("a", "first", null, "second");
}
@Test( expected = IllegalArgumentException.class )
public void
isNotSameShouldThrowAnExceptionIfPassedNullFirstObjectAndNullSecondObject() {
- ArgCheck.isNotSame(null, "first", null, "second");
+ CheckArg.isNotSame(null, "first", null, "second");
}
@Test( expected = IllegalArgumentException.class )
public void
isNotSameShouldThrowAnExceptionIfPassedSameReferenceForFirstSecondObject() {
String obj = "something";
- ArgCheck.isNotSame(obj, "first", obj, "second");
+ CheckArg.isNotSame(obj, "first", obj, "second");
}
@Test
public void containsShouldNotThrowExceptionIfPassedObjectInCollection() {
- ArgCheck.contains(Collections.singletonList(" "), " ",
"test");
+ CheckArg.contains(Collections.singletonList(" "), " ",
"test");
}
@Test
public void containsShouldNotThrowExceptionIfPassedNullIfCollectionContainsNull() {
- ArgCheck.contains(Collections.singletonList(null), null, "test");
+ CheckArg.contains(Collections.singletonList(null), null, "test");
}
@Test( expected = IllegalArgumentException.class )
public void containsShouldThrowExceptionIfPassedObjectNotInCollection() {
- ArgCheck.contains(Collections.singletonList(" "), "a",
"test");
+ CheckArg.contains(Collections.singletonList(" "), "a",
"test");
}
@Test( expected = IllegalArgumentException.class )
public void containsShouldThrowExceptionIfPassedNullAndCollectionDoesNotContainNull()
{
- ArgCheck.contains(Collections.singletonList(" "), null,
"test");
+ CheckArg.contains(Collections.singletonList(" "), null,
"test");
}
@Test
public void containsKeyShouldNotThrowExceptionIfPassedObjectInCollection() {
- ArgCheck.containsKey(Collections.singletonMap("key",
"value"), "key", "test");
+ CheckArg.containsKey(Collections.singletonMap("key",
"value"), "key", "test");
}
@Test
public void containsKeyShouldNotThrowExceptionIfPassedNullIfMapContainsNullKey() {
- ArgCheck.containsKey(Collections.singletonMap(null, "value"), null,
"test");
+ CheckArg.containsKey(Collections.singletonMap(null, "value"), null,
"test");
}
@Test( expected = IllegalArgumentException.class )
public void containsKeyShouldThrowExceptionIfPassedKeyNotInMap() {
- ArgCheck.containsKey(Collections.singletonMap("key",
"value"), "a", "test");
+ CheckArg.containsKey(Collections.singletonMap("key",
"value"), "a", "test");
}
@Test( expected = IllegalArgumentException.class )
public void containsKeyShouldThrowExceptionIfPassedNullAndMapDoesNotContainNullKey()
{
- ArgCheck.containsKey(Collections.singletonMap("key",
"value"), null, "test");
+ CheckArg.containsKey(Collections.singletonMap("key",
"value"), null, "test");
}
@Test
public void
containsNoNullsCollectionShouldNotThrowExceptionIfGivenArrayWithAtLeastOneEntry() {
- ArgCheck.containsNoNulls(Collections.singletonList(" "),
"test");
+ CheckArg.containsNoNulls(Collections.singletonList(" "),
"test");
}
@Test( expected = IllegalArgumentException.class )
public void containsNoNullsCollectionShouldThrowExceptionIfGivenNullCollection() {
- ArgCheck.containsNoNulls((Collection<?>)null, "test");
+ CheckArg.containsNoNulls((Collection<?>)null, "test");
}
@Test
public void containsNoNullsCollectionShouldNotThrowExceptionIfGivenEmptyCollection()
{
- ArgCheck.containsNoNulls(Collections.emptyList(), "test");
+ CheckArg.containsNoNulls(Collections.emptyList(), "test");
}
@Test( expected = IllegalArgumentException.class )
public void
containsNoNullsCollectionShouldThrowExceptionIfGivenCollectionWithNullEntry() {
- ArgCheck.containsNoNulls(Collections.singletonList(null), "test");
+ CheckArg.containsNoNulls(Collections.singletonList(null), "test");
}
@Test
public void
containsNoNullsArrayShouldNotThrowExceptionIfGivenArrayWithAtLeastOneEntry() {
- ArgCheck.containsNoNulls(new Object[] {"key", "value"},
"test");
+ CheckArg.containsNoNulls(new Object[] {"key", "value"},
"test");
}
@Test( expected = IllegalArgumentException.class )
public void containsNoNullsArrayShouldThrowExceptionIfGivenNullArray() {
- ArgCheck.containsNoNulls((Object[])null, "test");
+ CheckArg.containsNoNulls((Object[])null, "test");
}
@Test
public void containsNoNullsArrayShouldNotThrowExceptionIfGivenEmptyArray() {
- ArgCheck.containsNoNulls(new Object[] {}, "test");
+ CheckArg.containsNoNulls(new Object[] {}, "test");
}
@Test( expected = IllegalArgumentException.class )
public void containsNoNullsArrayShouldThrowExceptionIfGivenArrayWithNullEntry() {
- ArgCheck.containsNoNulls(new Object[] {"some", null, "thing",
null}, "test");
+ CheckArg.containsNoNulls(new Object[] {"some", null, "thing",
null}, "test");
}
@Test( expected = IllegalArgumentException.class )
public void isNotLessThanShouldThrowExceptionIfValueIsLessThanSuppliedValue() {
- ArgCheck.isNotLessThan(0, 1, "value");
+ CheckArg.isNotLessThan(0, 1, "value");
}
@Test( expected = IllegalArgumentException.class )
public void isNotGreaterThanShouldThrowExceptionIfValueIsGreaterThanSuppliedValue()
{
- ArgCheck.isNotGreaterThan(1, 0, "value");
+ CheckArg.isNotGreaterThan(1, 0, "value");
}
@Test( expected = IllegalArgumentException.class )
public void isNotLessThanShouldThrowExceptionIfValueIsEqualToSuppliedValue() {
- ArgCheck.isNotLessThan(1, 2, "value");
+ CheckArg.isNotLessThan(1, 2, "value");
}
@Test( expected = IllegalArgumentException.class )
public void isNotGreaterThanShouldThrowExceptionIfValueIsEqualToSuppliedValue() {
- ArgCheck.isNotGreaterThan(2, 1, "value");
+ CheckArg.isNotGreaterThan(2, 1, "value");
}
@Test( expected = IllegalArgumentException.class )
public void isLessThanShouldThrowExceptionIfValueIsGreaterThanSuppliedValue() {
- ArgCheck.isLessThan(1, 0, "value");
+ CheckArg.isLessThan(1, 0, "value");
}
@Test( expected = IllegalArgumentException.class )
public void isGreaterThanShouldThrowExceptionIfValueIsLessThanSuppliedValue() {
- ArgCheck.isGreaterThan(0, 1, "value");
+ CheckArg.isGreaterThan(0, 1, "value");
}
@Test( expected = IllegalArgumentException.class )
public void isLessThanShouldThrowExceptionIfValueIsEqualToSuppliedValue() {
- ArgCheck.isLessThan(1, 1, "value");
+ CheckArg.isLessThan(1, 1, "value");
}
@Test( expected = IllegalArgumentException.class )
public void isGreaterThanShouldThrowExceptionIfValueIsEqualToSuppliedValue() {
- ArgCheck.isGreaterThan(1, 1, "value");
+ CheckArg.isGreaterThan(1, 1, "value");
}
@Test( expected = IllegalArgumentException.class )
public void
isLessThanOrEqualToShouldThrowExceptionIfValueIsNotLessThanOrEqualToSuppliedValue() {
- ArgCheck.isLessThanOrEqualTo(1, 0, "value");
+ CheckArg.isLessThanOrEqualTo(1, 0, "value");
}
@Test( expected = IllegalArgumentException.class )
public void
isGreaterThanOrEqualToShouldThrowExceptionIfValueIsNotGreaterThanOrEqualToSuppliedValue()
{
- ArgCheck.isGreaterThanOrEqualTo(0, 1, "value");
+ CheckArg.isGreaterThanOrEqualTo(0, 1, "value");
}
@Test
public void isNotLessThanShouldNotThrowExceptionIfValueIsNotLessThanSuppliedValue()
{
- ArgCheck.isNotLessThan(1, 1, "value");
- ArgCheck.isNotLessThan(2, 1, "value");
- ArgCheck.isNotLessThan(100, 1, "value");
+ CheckArg.isNotLessThan(1, 1, "value");
+ CheckArg.isNotLessThan(2, 1, "value");
+ CheckArg.isNotLessThan(100, 1, "value");
}
@Test
public void
isNotGreaterThanShouldNotThrowExceptionIfValueIsNotGreaterThanSuppliedValue() {
- ArgCheck.isNotGreaterThan(1, 1, "value");
- ArgCheck.isNotGreaterThan(1, 2, "value");
- ArgCheck.isNotGreaterThan(1, 100, "value");
+ CheckArg.isNotGreaterThan(1, 1, "value");
+ CheckArg.isNotGreaterThan(1, 2, "value");
+ CheckArg.isNotGreaterThan(1, 100, "value");
}
@Test
public void isLessThanShouldNotThrowExceptionIfValueIsLessThanSuppliedValue() {
- ArgCheck.isLessThanOrEqualTo(1, 2, "value");
- ArgCheck.isLessThanOrEqualTo(1, 100, "value");
+ CheckArg.isLessThanOrEqualTo(1, 2, "value");
+ CheckArg.isLessThanOrEqualTo(1, 100, "value");
}
@Test
public void isGreaterThanShouldNotThrowExceptionIfValueIsGreaterThanSuppliedValue()
{
- ArgCheck.isGreaterThan(2, 1, "value");
- ArgCheck.isGreaterThan(100, 1, "value");
+ CheckArg.isGreaterThan(2, 1, "value");
+ CheckArg.isGreaterThan(100, 1, "value");
}
@Test
public void
isLessThanOrEqualToShouldNotThrowExceptionIfValueIsLessThanOrEqualToSuppliedValue() {
- ArgCheck.isLessThanOrEqualTo(1, 1, "value");
- ArgCheck.isLessThanOrEqualTo(1, 2, "value");
- ArgCheck.isLessThanOrEqualTo(1, 100, "value");
+ CheckArg.isLessThanOrEqualTo(1, 1, "value");
+ CheckArg.isLessThanOrEqualTo(1, 2, "value");
+ CheckArg.isLessThanOrEqualTo(1, 100, "value");
}
@Test
public void
isGreaterThanOrEqualToShouldNotThrowExceptionIfValueIsGreaterThanOrEqualToSuppliedValue()
{
- ArgCheck.isGreaterThanOrEqualTo(1, 1, "value");
- ArgCheck.isGreaterThanOrEqualTo(2, 1, "value");
- ArgCheck.isGreaterThanOrEqualTo(100, 1, "value");
+ CheckArg.isGreaterThanOrEqualTo(1, 1, "value");
+ CheckArg.isGreaterThanOrEqualTo(2, 1, "value");
+ CheckArg.isGreaterThanOrEqualTo(100, 1, "value");
}
@Test( expected = IllegalArgumentException.class )
public void
hasSizeOfAtLeastShouldThrowExceptionIfCollectionSizeIsSmallerThanSuppliedValue() {
- ArgCheck.hasSizeOfAtLeast(Collections.singletonList(" "), 2,
"value");
+ CheckArg.hasSizeOfAtLeast(Collections.singletonList(" "), 2,
"value");
}
@Test( expected = IllegalArgumentException.class )
public void
hasSizeOfAtMostShouldThrowExceptionIfCollectionSizeIsLargerThanSuppliedValue() {
- ArgCheck.hasSizeOfAtMost(Collections.singletonList(" "), 0,
"value");
+ CheckArg.hasSizeOfAtMost(Collections.singletonList(" "), 0,
"value");
}
@Test
public void
hasSizeOfAtLeastShouldNotThrowExceptionIfCollectionSizeIsEqualToSuppliedValue() {
- ArgCheck.hasSizeOfAtLeast(Collections.singletonList(" "), 1,
"value");
+ CheckArg.hasSizeOfAtLeast(Collections.singletonList(" "), 1,
"value");
}
@Test
public void
hasSizeOfAtMostShouldNotThrowExceptionIfCollectionSizeIsEqualToSuppliedValue() {
- ArgCheck.hasSizeOfAtMost(Collections.singletonList(" "), 1,
"value");
+ CheckArg.hasSizeOfAtMost(Collections.singletonList(" "), 1,
"value");
}
@Test
public void
hasSizeOfAtLeastShouldNotThrowExceptionIfCollectionSizeIsGreaterThanSuppliedValue() {
- ArgCheck.hasSizeOfAtLeast(Collections.singletonList(" "), 0,
"value");
+ CheckArg.hasSizeOfAtLeast(Collections.singletonList(" "), 0,
"value");
}
@Test
public void
hasSizeOfAtMostShouldNotThrowExceptionIfCollectionSizeIsGreaterThanSuppliedValue() {
- ArgCheck.hasSizeOfAtMost(Collections.singletonList(" "), 2,
"value");
+ CheckArg.hasSizeOfAtMost(Collections.singletonList(" "), 2,
"value");
}
@Test( expected = IllegalArgumentException.class )
public void hasSizeOfAtLeastShouldThrowExceptionIfMapSizeIsSmallerThanSuppliedValue()
{
- ArgCheck.hasSizeOfAtLeast(Collections.singletonMap("key",
"value"), 2, "value");
+ CheckArg.hasSizeOfAtLeast(Collections.singletonMap("key",
"value"), 2, "value");
}
@Test( expected = IllegalArgumentException.class )
public void hasSizeOfAtMostShouldThrowExceptionIfMapSizeIsLargerThanSuppliedValue()
{
- ArgCheck.hasSizeOfAtMost(Collections.singletonMap("key",
"value"), 0, "value");
+ CheckArg.hasSizeOfAtMost(Collections.singletonMap("key",
"value"), 0, "value");
}
@Test
public void hasSizeOfAtLeastShouldNotThrowExceptionIfMapSizeIsEqualToSuppliedValue()
{
- ArgCheck.hasSizeOfAtLeast(Collections.singletonMap("key",
"value"), 1, "value");
+ CheckArg.hasSizeOfAtLeast(Collections.singletonMap("key",
"value"), 1, "value");
}
@Test
public void hasSizeOfAtMostShouldNotThrowExceptionIfMapSizeIsEqualToSuppliedValue()
{
- ArgCheck.hasSizeOfAtMost(Collections.singletonMap("key",
"value"), 1, "value");
+ CheckArg.hasSizeOfAtMost(Collections.singletonMap("key",
"value"), 1, "value");
}
@Test
public void
hasSizeOfAtLeastShouldNotThrowExceptionIfMapSizeIsGreaterThanSuppliedValue() {
- ArgCheck.hasSizeOfAtLeast(Collections.singletonMap("key",
"value"), 0, "value");
+ CheckArg.hasSizeOfAtLeast(Collections.singletonMap("key",
"value"), 0, "value");
}
@Test
public void
hasSizeOfAtMostShouldNotThrowExceptionIfMapSizeIsGreaterThanSuppliedValue() {
- ArgCheck.hasSizeOfAtMost(Collections.singletonMap("key",
"value"), 2, "value");
+ CheckArg.hasSizeOfAtMost(Collections.singletonMap("key",
"value"), 2, "value");
}
@Test( expected = IllegalArgumentException.class )
public void
hasSizeOfAtLeastShouldThrowExceptionIfArraySizeIsSmallerThanSuppliedValue() {
- ArgCheck.hasSizeOfAtLeast(new Object[] {"key", "value"}, 3,
"value");
+ CheckArg.hasSizeOfAtLeast(new Object[] {"key", "value"}, 3,
"value");
}
@Test( expected = IllegalArgumentException.class )
public void hasSizeOfAtMostShouldThrowExceptionIfArraySizeIsLargerThanSuppliedValue()
{
- ArgCheck.hasSizeOfAtMost(new Object[] {"key", "value"}, 1,
"value");
+ CheckArg.hasSizeOfAtMost(new Object[] {"key", "value"}, 1,
"value");
}
@Test
public void
hasSizeOfAtLeastShouldNotThrowExceptionIfArraySizeIsEqualToSuppliedValue() {
- ArgCheck.hasSizeOfAtLeast(new Object[] {"key", "value"}, 2,
"value");
+ CheckArg.hasSizeOfAtLeast(new Object[] {"key", "value"}, 2,
"value");
}
@Test
public void hasSizeOfAtMostShouldNotThrowExceptionIfArraySizeIsEqualToSuppliedValue()
{
- ArgCheck.hasSizeOfAtMost(new Object[] {"key", "value"}, 2,
"value");
+ CheckArg.hasSizeOfAtMost(new Object[] {"key", "value"}, 2,
"value");
}
@Test
public void
hasSizeOfAtLeastShouldNotThrowExceptionIfArraySizeIsGreaterThanSuppliedValue() {
- ArgCheck.hasSizeOfAtLeast(new Object[] {"key", "value"}, 1,
"value");
+ CheckArg.hasSizeOfAtLeast(new Object[] {"key", "value"}, 1,
"value");
}
@Test
public void
hasSizeOfAtMostShouldNotThrowExceptionIfArraySizeIsGreaterThanSuppliedValue() {
- ArgCheck.hasSizeOfAtMost(new Object[] {"key", "value"}, 3,
"value");
+ CheckArg.hasSizeOfAtMost(new Object[] {"key", "value"}, 3,
"value");
}
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContexts.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContexts.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/ExecutionContexts.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -24,7 +24,7 @@
import java.security.AccessControlContext;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.properties.NameFactory;
import org.jboss.dna.graph.properties.NamespaceRegistry;
@@ -51,8 +51,8 @@
*/
public static ExecutionContext replace( ExecutionContext context,
PathFactory pathFactory ) {
- ArgCheck.isNotNull(context, "context");
- ArgCheck.isNotNull(pathFactory, "pathFactory");
+ CheckArg.isNotNull(context, "context");
+ CheckArg.isNotNull(pathFactory, "pathFactory");
return new DelegatingExecutionEnvironment(context, null, null, null,
pathFactory);
}
@@ -66,8 +66,8 @@
*/
public static ExecutionContext replace( ExecutionContext context,
NameFactory nameFactory ) {
- ArgCheck.isNotNull(context, "context");
- ArgCheck.isNotNull(nameFactory, "nameFactory");
+ CheckArg.isNotNull(context, "context");
+ CheckArg.isNotNull(nameFactory, "nameFactory");
return new DelegatingExecutionEnvironment(context, null, null, nameFactory,
null);
}
@@ -83,9 +83,9 @@
public static ExecutionContext replace( ExecutionContext context,
NameFactory nameFactory,
PathFactory pathFactory ) {
- ArgCheck.isNotNull(context, "context");
- ArgCheck.isNotNull(nameFactory, "nameFactory");
- ArgCheck.isNotNull(pathFactory, "pathFactory");
+ CheckArg.isNotNull(context, "context");
+ CheckArg.isNotNull(nameFactory, "nameFactory");
+ CheckArg.isNotNull(pathFactory, "pathFactory");
return new DelegatingExecutionEnvironment(context, null, null, nameFactory,
pathFactory);
}
@@ -99,8 +99,8 @@
*/
public static ExecutionContext replace( ExecutionContext context,
NamespaceRegistry namespaceRegistry ) {
- ArgCheck.isNotNull(context, "context");
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(context, "context");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
return new DelegatingExecutionEnvironment(context, namespaceRegistry, null, null,
null);
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/BasicCachePolicy.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/BasicCachePolicy.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/cache/BasicCachePolicy.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -22,7 +22,7 @@
package org.jboss.dna.graph.cache;
import java.util.concurrent.TimeUnit;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
/**
* @author Randall Hauch
@@ -37,7 +37,7 @@
public BasicCachePolicy( long timeToCache,
TimeUnit unit ) {
- ArgCheck.isNotNull(unit, "unit");
+ CheckArg.isNotNull(unit, "unit");
this.timeToLiveInMillis = TimeUnit.MILLISECONDS.convert(timeToCache, unit);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connectors/BasicExecutionContext.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connectors/BasicExecutionContext.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connectors/BasicExecutionContext.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -25,7 +25,7 @@
import java.security.AccessController;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.properties.NamespaceRegistry;
@@ -99,7 +99,7 @@
NamespaceRegistry namespaceRegistry,
ValueFactories valueFactories,
PropertyFactory propertyFactory ) {
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
this.loginContext = loginContext;
this.accessControlContext = accessControlContext;
if (loginContext == null) {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connectors/RepositoryConnectionPool.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connectors/RepositoryConnectionPool.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connectors/RepositoryConnectionPool.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -36,7 +36,7 @@
import javax.transaction.xa.XAResource;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.GraphI18n;
@@ -188,10 +188,10 @@
int maximumPoolSize,
long keepAliveTime,
TimeUnit unit ) {
- ArgCheck.isNonNegative(corePoolSize, "corePoolSize");
- ArgCheck.isPositive(maximumPoolSize, "maximumPoolSize");
- ArgCheck.isNonNegative(keepAliveTime, "keepAliveTime");
- ArgCheck.isNotNull(source, "source");
+ CheckArg.isNonNegative(corePoolSize, "corePoolSize");
+ CheckArg.isPositive(maximumPoolSize, "maximumPoolSize");
+ CheckArg.isNonNegative(keepAliveTime, "keepAliveTime");
+ CheckArg.isNotNull(source, "source");
if (maximumPoolSize < corePoolSize) {
throw new
IllegalArgumentException(GraphI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
}
@@ -251,7 +251,7 @@
*/
public void setPingTimeout( long pingTimeout,
TimeUnit unit ) {
- ArgCheck.isNonNegative(pingTimeout, "time");
+ CheckArg.isNonNegative(pingTimeout, "time");
this.pingTimeout.set(unit.toNanos(pingTimeout));
}
@@ -282,7 +282,7 @@
*/
public void setKeepAliveTime( long time,
TimeUnit unit ) {
- ArgCheck.isNonNegative(time, "time");
+ CheckArg.isNonNegative(time, "time");
this.keepAliveTime = unit.toNanos(time);
}
@@ -315,7 +315,7 @@
* @see #getMaximumPoolSize
*/
public void setMaximumPoolSize( int maximumPoolSize ) {
- ArgCheck.isPositive(maximumPoolSize, "maximum pool size");
+ CheckArg.isPositive(maximumPoolSize, "maximum pool size");
if (maximumPoolSize < corePoolSize) {
throw new
IllegalArgumentException(GraphI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
}
@@ -355,7 +355,7 @@
* @see #getCorePoolSize()
*/
public void setCorePoolSize( int corePoolSize ) throws RepositorySourceException,
InterruptedException {
- ArgCheck.isNonNegative(corePoolSize, "core pool size");
+ CheckArg.isNonNegative(corePoolSize, "core pool size");
if (maximumPoolSize < corePoolSize) {
throw new
IllegalArgumentException(GraphI18n.maximumPoolSizeMayNotBeSmallerThanCorePoolSize.text());
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/PathExpression.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/PathExpression.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/PathExpression.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -25,7 +25,7 @@
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.graph.GraphI18n;
@@ -201,7 +201,7 @@
* @throws InvalidPathExpressionException if the expression is blank or is not a
valid expression
*/
public PathExpression( String expression ) throws InvalidPathExpressionException {
- ArgCheck.isNotNull(expression, "path expression");
+ CheckArg.isNotNull(expression, "path expression");
this.expression = expression.trim();
if (this.expression.length() == 0) {
throw new
InvalidPathExpressionException(GraphI18n.pathExpressionMayNotBeBlank.text());
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/AbstractValueFactories.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/AbstractValueFactories.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/AbstractValueFactories.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -22,7 +22,7 @@
package org.jboss.dna.graph.properties.basic;
import java.util.Iterator;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.PropertyType;
import org.jboss.dna.graph.properties.ValueFactories;
import org.jboss.dna.graph.properties.ValueFactory;
@@ -52,7 +52,7 @@
* {@inheritDoc}
*/
public ValueFactory<?> getValueFactory( PropertyType type ) {
- ArgCheck.isNotNull(type, "type");
+ CheckArg.isNotNull(type, "type");
switch (type) {
case BINARY:
return getBinaryFactory();
@@ -88,7 +88,7 @@
* {@inheritDoc}
*/
public ValueFactory<?> getValueFactory( Object prototype ) {
- ArgCheck.isNotNull(prototype, "prototype");
+ CheckArg.isNotNull(prototype, "prototype");
PropertyType inferredType = PropertyType.discoverType(prototype);
assert inferredType != null;
return getValueFactory(inferredType);
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/AbstractValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/AbstractValueFactory.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/AbstractValueFactory.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -31,7 +31,7 @@
import java.util.UUID;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextDecoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.Binary;
import org.jboss.dna.graph.properties.DateTime;
import org.jboss.dna.graph.properties.IoException;
@@ -59,7 +59,7 @@
protected AbstractValueFactory( PropertyType type,
TextDecoder decoder,
ValueFactory<String> stringValueFactory ) {
- ArgCheck.isNotNull(type, "type");
+ CheckArg.isNotNull(type, "type");
this.propertyType = type;
this.decoder = decoder != null ? decoder : DEFAULT_DECODER;
this.stringValueFactory = stringValueFactory;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicMultiValueProperty.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicMultiValueProperty.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicMultiValueProperty.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -25,7 +25,7 @@
import java.util.Iterator;
import java.util.List;
import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.Name;
/**
@@ -50,8 +50,8 @@
public BasicMultiValueProperty( Name name,
List<Object> values ) {
super(name);
- ArgCheck.isNotNull(values, "values");
- ArgCheck.hasSizeOfAtLeast(values, 2, "values");
+ CheckArg.isNotNull(values, "values");
+ CheckArg.hasSizeOfAtLeast(values, 2, "values");
this.values = values;
}
@@ -65,8 +65,8 @@
public BasicMultiValueProperty( Name name,
Object... values ) {
super(name);
- ArgCheck.isNotNull(values, "values");
- ArgCheck.hasSizeOfAtLeast(values, 2, "values");
+ CheckArg.isNotNull(values, "values");
+ CheckArg.hasSizeOfAtLeast(values, 2, "values");
this.values = Arrays.asList(values);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicName.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicName.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicName.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -23,7 +23,7 @@
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.graph.properties.Name;
import org.jboss.dna.graph.properties.NamespaceRegistry;
@@ -47,7 +47,7 @@
public BasicName( String namespaceUri,
String localName ) {
- ArgCheck.isNotEmpty(localName, "localName");
+ CheckArg.isNotEmpty(localName, "localName");
this.namespaceUri = namespaceUri != null ? namespaceUri.trim() : "";
this.localName = localName != null ? localName.trim() : "";
this.hc = HashCode.compute(this.namespaceUri, this.localName);
@@ -90,7 +90,7 @@
* {@inheritDoc}
*/
public String getString( NamespaceRegistry namespaceRegistry ) {
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
String prefix = namespaceRegistry.getPrefixForNamespaceUri(this.namespaceUri,
true);
if (prefix != null && prefix.length() != 0) {
return prefix + ":" + this.localName;
@@ -103,7 +103,7 @@
*/
public String getString( NamespaceRegistry namespaceRegistry,
TextEncoder encoder ) {
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
String prefix = namespaceRegistry.getPrefixForNamespaceUri(this.namespaceUri,
true);
if (prefix != null && prefix.length() != 0) {
return encoder.encode(prefix) + ":" +
encoder.encode(this.localName);
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicNamespaceRegistry.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicNamespaceRegistry.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicNamespaceRegistry.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -32,7 +32,7 @@
import java.util.concurrent.locks.ReentrantReadWriteLock;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.NamespaceRegistry;
/**
@@ -96,7 +96,7 @@
* {@inheritDoc}
*/
public String getNamespaceForPrefix( String prefix ) {
- ArgCheck.isNotNull(prefix, "prefix");
+ CheckArg.isNotNull(prefix, "prefix");
Lock lock = this.registryLock.readLock();
try {
lock.lock();
@@ -111,7 +111,7 @@
*/
public String getPrefixForNamespaceUri( String namespaceUri,
boolean generateIfMissing ) {
- ArgCheck.isNotNull(namespaceUri, "namespaceUri");
+ CheckArg.isNotNull(namespaceUri, "namespaceUri");
String prefix = null;
Lock lock = this.registryLock.readLock();
try {
@@ -144,7 +144,7 @@
* {@inheritDoc}
*/
public boolean isRegisteredNamespaceUri( String namespaceUri ) {
- ArgCheck.isNotNull(namespaceUri, "namespaceUri");
+ CheckArg.isNotNull(namespaceUri, "namespaceUri");
Lock lock = this.registryLock.readLock();
try {
lock.lock();
@@ -172,7 +172,7 @@
*/
public String register( String prefix,
String namespaceUri ) {
- ArgCheck.isNotNull(namespaceUri, "namespaceUri");
+ CheckArg.isNotNull(namespaceUri, "namespaceUri");
String previousNamespaceForPrefix = null;
namespaceUri = namespaceUri.trim();
Lock lock = this.registryLock.writeLock();
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPath.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPath.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPath.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -30,7 +30,7 @@
import org.jboss.dna.common.CommonI18n;
import org.jboss.dna.common.text.Inflector;
import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.GraphI18n;
import org.jboss.dna.graph.properties.InvalidPathException;
import org.jboss.dna.graph.properties.NamespaceRegistry;
@@ -66,7 +66,7 @@
*/
public BasicPath( List<Segment> segments,
boolean absolute ) {
- ArgCheck.isNotNull(segments, "segments");
+ CheckArg.isNotNull(segments, "segments");
this.segments = segments.isEmpty() ? EMPTY_SEGMENTS :
Collections.unmodifiableList(segments);
this.absolute = absolute;
this.normalized = isNormalized(this.segments);
@@ -92,7 +92,7 @@
* {@inheritDoc}
*/
public Path getAncestor( int degree ) {
- ArgCheck.isNonNegative(degree, "degree");
+ CheckArg.isNonNegative(degree, "degree");
if (degree == 0) return this;
if (this.isRoot()) return null;
int endIndex = this.segments.size() - degree;
@@ -213,7 +213,7 @@
* {@inheritDoc}
*/
public String getString( NamespaceRegistry namespaceRegistry ) {
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
return doGetString(namespaceRegistry, null);
}
@@ -222,7 +222,7 @@
*/
public String getString( NamespaceRegistry namespaceRegistry,
TextEncoder encoder ) {
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
return doGetString(namespaceRegistry, encoder);
}
@@ -378,7 +378,7 @@
* {@inheritDoc}
*/
public Path relativeTo( Path startingPath ) {
- ArgCheck.isNotNull(startingPath, "to");
+ CheckArg.isNotNull(startingPath, "to");
if (!this.isAbsolute()) {
String msg = GraphI18n.pathIsNotAbsolute.text(this);
throw new InvalidPathException(msg);
@@ -421,7 +421,7 @@
* {@inheritDoc}
*/
public Path resolve( Path relativePath ) {
- ArgCheck.isNotNull(relativePath, "relative path");
+ CheckArg.isNotNull(relativePath, "relative path");
if (!this.isAbsolute()) {
String msg = GraphI18n.pathIsAlreadyAbsolute.text(this.path);
throw new InvalidPathException(msg);
@@ -447,7 +447,7 @@
* {@inheritDoc}
*/
public Path resolveAgainst( Path absolutePath ) {
- ArgCheck.isNotNull(absolutePath, "absolute path");
+ CheckArg.isNotNull(absolutePath, "absolute path");
return absolutePath.resolve(this);
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPathSegment.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPathSegment.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPathSegment.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -23,7 +23,7 @@
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.Name;
import org.jboss.dna.graph.properties.NamespaceRegistry;
import org.jboss.dna.graph.properties.Path;
@@ -57,8 +57,8 @@
*/
public BasicPathSegment( Name name,
int index ) {
- ArgCheck.isNotNull(name, "name");
- ArgCheck.isNotLessThan(index, Path.NO_INDEX, "index");
+ CheckArg.isNotNull(name, "name");
+ CheckArg.isNotLessThan(index, Path.NO_INDEX, "index");
this.name = name;
this.index = (this.isSelfReference() || this.isParentReference()) ? Path.NO_INDEX
: index;
}
@@ -179,7 +179,7 @@
*/
public String getString( NamespaceRegistry namespaceRegistry,
TextEncoder encoder ) {
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
if (encoder == null) encoder = Path.DEFAULT_ENCODER;
String encodedName = this.getName().getString(namespaceRegistry, encoder);
if (this.hasIndex()) {
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPropertyFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPropertyFactory.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/BasicPropertyFactory.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -25,7 +25,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.Name;
import org.jboss.dna.graph.properties.Property;
import org.jboss.dna.graph.properties.PropertyFactory;
@@ -45,7 +45,7 @@
* @throws IllegalArgumentException if the reference to the value factories is null
*/
public BasicPropertyFactory( ValueFactories valueFactories ) {
- ArgCheck.isNotNull(valueFactories, "value factories");
+ CheckArg.isNotNull(valueFactories, "value factories");
this.factories = valueFactories;
}
@@ -79,7 +79,7 @@
public Property create( Name name,
PropertyType desiredType,
Object... values ) {
- ArgCheck.isNotNull(name, "name");
+ CheckArg.isNotNull(name, "name");
if (values == null || values.length == 0) {
return new BasicEmptyProperty(name);
}
@@ -111,7 +111,7 @@
public Property create( Name name,
PropertyType desiredType,
Iterable<?> values ) {
- ArgCheck.isNotNull(name, "name");
+ CheckArg.isNotNull(name, "name");
List<Object> valueList = null;
if (values instanceof Collection) {
Collection<Object> originalValues = (Collection<Object>)values;
@@ -144,7 +144,7 @@
public Property create( Name name,
PropertyType desiredType,
Iterator<?> values ) {
- ArgCheck.isNotNull(name, "name");
+ CheckArg.isNotNull(name, "name");
final List<Object> valueList = new ArrayList<Object>();
if (desiredType == null) desiredType = PropertyType.OBJECT;
final ValueFactory<?> factory = factories.getValueFactory(desiredType);
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/InMemoryBinary.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/InMemoryBinary.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/InMemoryBinary.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -28,7 +28,7 @@
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.GraphI18n;
import org.jboss.dna.graph.properties.Binary;
@@ -56,7 +56,7 @@
private byte[] sha1hash;
public InMemoryBinary( byte[] bytes ) {
- ArgCheck.isNotNull(bytes, "bytes");
+ CheckArg.isNotNull(bytes, "bytes");
this.bytes = bytes;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/JodaDateTime.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/JodaDateTime.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/JodaDateTime.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -27,7 +27,7 @@
import java.util.Locale;
import java.util.concurrent.TimeUnit;
import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.joda.time.Chronology;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
@@ -372,7 +372,7 @@
* {@inheritDoc}
*/
public org.jboss.dna.graph.properties.DateTime toTimeZone( String timeZoneId ) {
- ArgCheck.isNotNull(timeZoneId, "time zone identifier");
+ CheckArg.isNotNull(timeZoneId, "time zone identifier");
DateTime jodaTime = this.instance.withZone(DateTimeZone.forID(timeZoneId));
return new JodaDateTime(jodaTime);
}
@@ -411,7 +411,7 @@
*/
public org.jboss.dna.graph.properties.DateTime minus( long timeAmount,
TimeUnit unit ) {
- ArgCheck.isNotNull(unit, "unit");
+ CheckArg.isNotNull(unit, "unit");
return new
JodaDateTime(this.instance.minus(TimeUnit.MILLISECONDS.convert(timeAmount, unit)));
}
@@ -494,7 +494,7 @@
*/
public org.jboss.dna.graph.properties.DateTime plus( long timeAmount,
TimeUnit unit ) {
- ArgCheck.isNotNull(unit, "unit");
+ CheckArg.isNotNull(unit, "unit");
return new
JodaDateTime(this.instance.plus(TimeUnit.MILLISECONDS.convert(timeAmount, unit)));
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/NameValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/NameValueFactory.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/NameValueFactory.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -32,7 +32,7 @@
import java.util.regex.Pattern;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextDecoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.GraphI18n;
import org.jboss.dna.graph.properties.Binary;
import org.jboss.dna.graph.properties.DateTime;
@@ -70,7 +70,7 @@
TextDecoder decoder,
ValueFactory<String> stringValueFactory ) {
super(PropertyType.NAME, decoder, stringValueFactory);
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
this.namespaceRegistry = namespaceRegistry;
}
@@ -140,7 +140,7 @@
public Name create( String namespaceUri,
String localName,
TextDecoder decoder ) {
- ArgCheck.isNotEmpty(localName, "localName");
+ CheckArg.isNotEmpty(localName, "localName");
if (decoder == null) decoder = getDecoder();
namespaceUri = namespaceUri != null ? decoder.decode(namespaceUri.trim()) :
null;
localName = decoder.decode(localName.trim());
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/ObjectValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/ObjectValueFactory.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/ObjectValueFactory.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -30,7 +30,7 @@
import java.util.UUID;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextDecoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.Binary;
import org.jboss.dna.graph.properties.DateTime;
import org.jboss.dna.graph.properties.IoException;
@@ -56,7 +56,7 @@
ValueFactory<String> stringValueFactory,
ValueFactory<Binary> binaryValueFactory ) {
super(PropertyType.OBJECT, decoder, stringValueFactory);
- ArgCheck.isNotNull(binaryValueFactory, "binaryValueFactory");
+ CheckArg.isNotNull(binaryValueFactory, "binaryValueFactory");
this.binaryValueFactory = binaryValueFactory;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/PathValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/PathValueFactory.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/PathValueFactory.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -34,7 +34,7 @@
import java.util.regex.Pattern;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextDecoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.GraphI18n;
import org.jboss.dna.graph.properties.Binary;
import org.jboss.dna.graph.properties.DateTime;
@@ -85,7 +85,7 @@
ValueFactory<String> stringValueFactory,
ValueFactory<Name> nameValueFactory ) {
super(PropertyType.PATH, decoder, stringValueFactory);
- ArgCheck.isNotNull(nameValueFactory, "nameValueFactory");
+ CheckArg.isNotNull(nameValueFactory, "nameValueFactory");
this.nameValueFactory = nameValueFactory;
}
@@ -278,7 +278,7 @@
List<Segment> segments = new
ArrayList<Segment>(segmentNames.length);
for (Name segmentName : segmentNames) {
if (segmentName == null) {
- ArgCheck.containsNoNulls(segmentNames, "segment names");
+ CheckArg.containsNoNulls(segmentNames, "segment names");
}
segments.add(new BasicPathSegment(segmentName));
}
@@ -293,7 +293,7 @@
List<Segment> segmentsList = new
ArrayList<Segment>(segments.length);
for (Segment segment : segments) {
if (segment == null) {
- ArgCheck.containsNoNulls(segments, "segments");
+ CheckArg.containsNoNulls(segments, "segments");
}
segmentsList.add(segment);
}
@@ -309,7 +309,7 @@
List<Segment> segmentsList = new LinkedList<Segment>();
for (Segment segment : segments) {
if (segment == null) {
- ArgCheck.containsNoNulls(segments, "segments");
+ CheckArg.containsNoNulls(segments, "segments");
}
segmentsList.add(segment);
}
@@ -336,7 +336,7 @@
List<Segment> segments = new
ArrayList<Segment>(segmentNames.length);
for (Name segmentName : segmentNames) {
if (segmentName == null) {
- ArgCheck.containsNoNulls(segmentNames, "segment names");
+ CheckArg.containsNoNulls(segmentNames, "segment names");
}
segments.add(new BasicPathSegment(segmentName));
}
@@ -351,7 +351,7 @@
List<Segment> segmentsList = new
ArrayList<Segment>(segments.length);
for (Segment segment : segments) {
if (segment == null) {
- ArgCheck.containsNoNulls(segments, "segments");
+ CheckArg.containsNoNulls(segments, "segments");
}
segmentsList.add(segment);
}
@@ -367,7 +367,7 @@
List<Segment> segmentsList = new LinkedList<Segment>();
for (Segment segment : segments) {
if (segment == null) {
- ArgCheck.containsNoNulls(segments, "segments");
+ CheckArg.containsNoNulls(segments, "segments");
}
segmentsList.add(segment);
}
@@ -382,8 +382,8 @@
*/
public Path create( Path parentPath,
Path childPath ) {
- ArgCheck.isNotNull(parentPath, "parent path");
- ArgCheck.isNotNull(childPath, "child path");
+ CheckArg.isNotNull(parentPath, "parent path");
+ CheckArg.isNotNull(childPath, "child path");
if (childPath.size() == 0) return parentPath;
if (parentPath.size() == 0) {
// Just need to return the child path, but it must be absolute if the parent
is ...
@@ -403,8 +403,8 @@
public Path create( Path parentPath,
Name segmentName,
int index ) {
- ArgCheck.isNotNull(parentPath, "parent path");
- ArgCheck.isNotNull(segmentName, "segment name");
+ CheckArg.isNotNull(parentPath, "parent path");
+ CheckArg.isNotNull(segmentName, "segment name");
List<Segment> segments = new ArrayList<Segment>(parentPath.size() +
1);
segments.addAll(parentPath.getSegmentsList());
segments.add(new BasicPathSegment(segmentName, index));
@@ -416,14 +416,14 @@
*/
public Path create( Path parentPath,
Name... segmentNames ) {
- ArgCheck.isNotNull(parentPath, "parent path");
+ CheckArg.isNotNull(parentPath, "parent path");
if (segmentNames == null || segmentNames.length == 0) return parentPath;
List<Segment> segments = new ArrayList<Segment>(parentPath.size() +
1);
segments.addAll(parentPath.getSegmentsList());
for (Name segmentName : segmentNames) {
if (segmentName == null) {
- ArgCheck.containsNoNulls(segmentNames, "segment names");
+ CheckArg.containsNoNulls(segmentNames, "segment names");
}
segments.add(new BasicPathSegment(segmentName));
}
@@ -435,14 +435,14 @@
*/
public Path create( Path parentPath,
Segment... segments ) {
- ArgCheck.isNotNull(parentPath, "parent path");
+ CheckArg.isNotNull(parentPath, "parent path");
if (segments == null || segments.length == 0) return BasicPath.ROOT;
List<Segment> segmentsList = new ArrayList<Segment>(parentPath.size()
+ 1);
segmentsList.addAll(parentPath.getSegmentsList());
for (Segment segment : segments) {
if (segment == null) {
- ArgCheck.containsNoNulls(segments, "segments");
+ CheckArg.containsNoNulls(segments, "segments");
}
segmentsList.add(segment);
}
@@ -456,13 +456,13 @@
*/
public Path create( Path parentPath,
Iterable<Segment> segments ) {
- ArgCheck.isNotNull(parentPath, "parent path");
+ CheckArg.isNotNull(parentPath, "parent path");
List<Segment> segmentsList = new LinkedList<Segment>();
segmentsList.addAll(parentPath.getSegmentsList());
for (Segment segment : segments) {
if (segment == null) {
- ArgCheck.containsNoNulls(segments, "segments");
+ CheckArg.containsNoNulls(segments, "segments");
}
segmentsList.add(segment);
}
@@ -486,7 +486,7 @@
* {@inheritDoc}
*/
public Segment createSegment( Name segmentName ) {
- ArgCheck.isNotNull(segmentName, "segment name");
+ CheckArg.isNotNull(segmentName, "segment name");
if (Path.SELF_NAME.equals(segmentName)) return Path.SELF_SEGMENT;
if (Path.PARENT_NAME.equals(segmentName)) return Path.PARENT_SEGMENT;
return new BasicPathSegment(segmentName);
@@ -497,7 +497,7 @@
*/
public Segment createSegment( Name segmentName,
int index ) {
- ArgCheck.isNotNull(segmentName, "segment name");
+ CheckArg.isNotNull(segmentName, "segment name");
if (Path.SELF_NAME.equals(segmentName)) return Path.SELF_SEGMENT;
if (Path.PARENT_NAME.equals(segmentName)) return Path.PARENT_SEGMENT;
return new BasicPathSegment(segmentName, index);
@@ -521,7 +521,7 @@
*/
public Segment createSegment( String segmentName,
TextDecoder decoder ) {
- ArgCheck.isNotNull(segmentName, "segment name");
+ CheckArg.isNotNull(segmentName, "segment name");
if (Path.SELF.equals(segmentName)) return Path.SELF_SEGMENT;
if (Path.PARENT.equals(segmentName)) return Path.PARENT_SEGMENT;
int startBracketNdx = segmentName.indexOf('[');
@@ -547,7 +547,7 @@
*/
public Segment createSegment( String segmentName,
int index ) {
- ArgCheck.isNotNull(segmentName, "segment name");
+ CheckArg.isNotNull(segmentName, "segment name");
if (Path.SELF.equals(segmentName)) return Path.SELF_SEGMENT;
if (Path.PARENT.equals(segmentName)) return Path.PARENT_SEGMENT;
return new BasicPathSegment(this.nameValueFactory.create(segmentName), index);
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/StandardValueFactories.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/StandardValueFactories.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/StandardValueFactories.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -28,7 +28,7 @@
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextDecoder;
import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.Binary;
import org.jboss.dna.graph.properties.DateTimeFactory;
import org.jboss.dna.graph.properties.NameFactory;
@@ -90,7 +90,7 @@
TextDecoder decoder,
TextEncoder encoder,
ValueFactory<?>... extraFactories ) {
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
this.namespaceRegistry = namespaceRegistry;
this.decoder = decoder != null ? decoder : ValueFactory.DEFAULT_DECODER;
this.encoder = encoder != null ? encoder : ValueFactory.DEFAULT_ENCODER;
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/StringValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/StringValueFactory.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/StringValueFactory.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -33,7 +33,7 @@
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextDecoder;
import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.IoUtil;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.GraphI18n;
@@ -61,7 +61,7 @@
public StringValueFactory( TextDecoder decoder,
TextEncoder encoder ) {
super(PropertyType.STRING, decoder, null);
- ArgCheck.isNotNull(encoder, "encoder");
+ CheckArg.isNotNull(encoder, "encoder");
this.encoder = encoder;
}
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/UriValueFactory.java
===================================================================
---
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/UriValueFactory.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/main/java/org/jboss/dna/graph/properties/basic/UriValueFactory.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -31,7 +31,7 @@
import java.util.UUID;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextDecoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.GraphI18n;
import org.jboss.dna.graph.properties.Binary;
import org.jboss.dna.graph.properties.DateTime;
@@ -59,7 +59,7 @@
TextDecoder decoder,
ValueFactory<String> stringValueFactory ) {
super(PropertyType.URI, decoder, stringValueFactory);
- ArgCheck.isNotNull(namespaceRegistry, "namespaceRegistry");
+ CheckArg.isNotNull(namespaceRegistry, "namespaceRegistry");
this.namespaceRegistry = namespaceRegistry;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/util/GraphImporter.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/util/GraphImporter.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/util/GraphImporter.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -38,7 +38,7 @@
import org.jboss.dna.common.i18n.I18n;
import org.jboss.dna.common.monitor.ProgressMonitor;
import org.jboss.dna.common.monitor.SimpleProgressMonitor;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.GraphI18n;
@@ -163,8 +163,8 @@
*/
public void into( String sourceName,
Path pathInSource ) throws IOException,
RepositorySourceException {
- ArgCheck.isNotNull(sourceName, "sourceName");
- ArgCheck.isNotNull(pathInSource, "pathInSource");
+ CheckArg.isNotNull(sourceName, "sourceName");
+ CheckArg.isNotNull(pathInSource, "pathInSource");
importWithSequencer(getSequencer(), uri, mimeType, sourceName, pathInSource,
getConflictBehavior());
}
}
@@ -174,8 +174,8 @@
public GraphImporter( RepositoryConnectionFactory sources,
ExecutionContext context ) {
- ArgCheck.isNotNull(sources, "sources");
- ArgCheck.isNotNull(context, "context");
+ CheckArg.isNotNull(sources, "sources");
+ CheckArg.isNotNull(context, "context");
this.sources = sources;
this.context = context;
}
@@ -198,7 +198,7 @@
* @throws IllegalArgumentException if the <code>uri</code> or
destination path are null
*/
public ImportSpecification importXml( URI uri ) {
- ArgCheck.isNotNull(uri, "uri");
+ CheckArg.isNotNull(uri, "uri");
// Create the sequencer ...
StreamSequencer sequencer = new XmlSequencer();
@@ -214,7 +214,7 @@
* @throws IllegalArgumentException if the <code>uri</code> or
destination path are null
*/
public ImportSpecification importXml( String pathToFile ) {
- ArgCheck.isNotNull(pathToFile, "pathToFile");
+ CheckArg.isNotNull(pathToFile, "pathToFile");
return importXml(new File(pathToFile).toURI());
}
@@ -227,7 +227,7 @@
* @throws IllegalArgumentException if the <code>uri</code> or
destination path are null
*/
public ImportSpecification importXml( File file ) {
- ArgCheck.isNotNull(file, "file");
+ CheckArg.isNotNull(file, "file");
return importXml(file.toURI());
}
@@ -246,8 +246,8 @@
public void importXml( URI uri,
String sourceName,
Path destinationPathInSource ) throws IOException,
RepositorySourceException {
- ArgCheck.isNotNull(uri, "uri");
- ArgCheck.isNotNull(destinationPathInSource,
"destinationPathInSource");
+ CheckArg.isNotNull(uri, "uri");
+ CheckArg.isNotNull(destinationPathInSource,
"destinationPathInSource");
// Create the sequencer ...
StreamSequencer sequencer = new XmlSequencer();
@@ -354,7 +354,7 @@
private final RepositorySource source;
protected SingleRepositorySourceConnectionFactory( RepositorySource source ) {
- ArgCheck.isNotNull(source, "source");
+ CheckArg.isNotNull(source, "source");
this.source = source;
}
@@ -381,8 +381,8 @@
protected ImporterCommands( Path destinationPath,
NodeConflictBehavior conflictBehavior ) {
- ArgCheck.isNotNull(destinationPath, "destinationPath");
- ArgCheck.isNotNull(conflictBehavior, "conflictBehavior");
+ CheckArg.isNotNull(destinationPath, "destinationPath");
+ CheckArg.isNotNull(conflictBehavior, "conflictBehavior");
this.conflictBehavior = conflictBehavior;
this.destinationPath = destinationPath;
this.nameFactory = getContext().getValueFactories().getNameFactory();
Modified:
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connectors/RepositoryOperations.java
===================================================================
---
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connectors/RepositoryOperations.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connectors/RepositoryOperations.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -25,7 +25,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.LogContext;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.connectors.RepositoryConnection;
@@ -55,7 +55,7 @@
public static <T> T call( ExecutionContext context,
RepositoryConnectionPool pool,
RepositoryOperation<T> operation ) throws
RepositorySourceException, InterruptedException {
- ArgCheck.isNotNull(operation, "repository operation");
+ CheckArg.isNotNull(operation, "repository operation");
// Get a connection ...
T result = null;
LogContext.set("context", operation.getName());
@@ -86,7 +86,7 @@
public static <T> Callable<T> createCallable( final ExecutionContext
context,
final RepositoryConnectionPool pool,
final RepositoryOperation<T>
operation ) {
- ArgCheck.isNotNull(operation, "repository operation");
+ CheckArg.isNotNull(operation, "repository operation");
return new Callable<T>() {
/**
Modified:
trunk/dna-graph/src/test/java/org/jboss/dna/graph/properties/AbstractValueComparatorsTest.java
===================================================================
---
trunk/dna-graph/src/test/java/org/jboss/dna/graph/properties/AbstractValueComparatorsTest.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-graph/src/test/java/org/jboss/dna/graph/properties/AbstractValueComparatorsTest.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -29,7 +29,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.ValueFactories;
import org.jboss.dna.graph.properties.basic.BasicNamespaceRegistry;
import org.jboss.dna.graph.properties.basic.StandardValueFactories;
@@ -48,8 +48,8 @@
protected final T[] validNonNullValues;
protected AbstractValueComparatorsTest( Comparator<T> comparator, T...
validNonNullValues ) {
- ArgCheck.isNotNull(comparator, "comparator");
- ArgCheck.isNotEmpty(validNonNullValues, "validNonNullValues");
+ CheckArg.isNotNull(comparator, "comparator");
+ CheckArg.isNotEmpty(validNonNullValues, "validNonNullValues");
this.comparator = comparator;
this.validNonNullValues = validNonNullValues;
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java 2008-09-18 18:00:04
UTC (rev 534)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java 2008-09-18 18:12:00
UTC (rev 535)
@@ -45,7 +45,7 @@
import javax.jcr.version.Version;
import javax.jcr.version.VersionHistory;
import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.Name;
import org.jboss.dna.graph.properties.Path.Segment;
@@ -73,7 +73,7 @@
* @see javax.jcr.Item#accept(javax.jcr.ItemVisitor)
*/
public final void accept( ItemVisitor visitor ) throws RepositoryException {
- ArgCheck.isNotNull(visitor, "visitor");
+ CheckArg.isNotNull(visitor, "visitor");
visitor.visit(this);
}
@@ -165,7 +165,7 @@
* @see javax.jcr.Item#getAncestor(int)
*/
public final Item getAncestor( int depth ) throws RepositoryException {
- ArgCheck.isNonNegative(depth, "depth");
+ CheckArg.isNonNegative(depth, "depth");
Node ancestor = this;
while (--depth >= 0) {
ancestor = ancestor.getParent();
@@ -234,7 +234,7 @@
* @see javax.jcr.Node#getNode(java.lang.String)
*/
public final Node getNode( String relativePath ) throws RepositoryException {
- ArgCheck.isNotEmpty(relativePath, "relativePath");
+ CheckArg.isNotEmpty(relativePath, "relativePath");
Item item = getSession().getItem(getPath(getPath(), relativePath));
if (item instanceof Node) {
return (Node)item;
@@ -261,12 +261,12 @@
// TODO: Implement after changing impl to delegate to Graph API
throw new UnsupportedOperationException();
/*
- ArgCheck.isNotEmpty(namePattern, "namePattern");
+ CheckArg.isNotEmpty(namePattern, "namePattern");
String[] disjuncts = namePattern.split("\\|");
List<Segment> nodes = new ArrayList<Segment>();
for (String disjunct : disjuncts) {
String pattern = disjunct.trim();
- ArgCheck.isNotEmpty(pattern, "namePattern");
+ CheckArg.isNotEmpty(pattern, "namePattern");
String ndxPattern;
int endNdx = pattern.length() - 1;
if (pattern.charAt(endNdx) == ']') {
@@ -337,7 +337,7 @@
* @see javax.jcr.Node#getProperty(java.lang.String)
*/
public final Property getProperty( String relativePath ) throws RepositoryException
{
- ArgCheck.isNotEmpty(relativePath, "relativePath");
+ CheckArg.isNotEmpty(relativePath, "relativePath");
if (relativePath.indexOf('/') >= 0) {
Item item = session.getItem(getPath(getPath(), relativePath));
if (item instanceof Property) {
@@ -413,13 +413,13 @@
* @see javax.jcr.Node#hasNode(java.lang.String)
*/
public final boolean hasNode( String relativePath ) throws RepositoryException {
- ArgCheck.isNotEmpty(relativePath, "relativePath");
+ CheckArg.isNotEmpty(relativePath, "relativePath");
if (relativePath.indexOf('/') >= 0) {
return (getNode(relativePath) != null);
}
int ndxNdx = relativePath.indexOf('[');
String name = (ndxNdx < 0 ? relativePath : relativePath.substring(0,
ndxNdx));
- ArgCheck.isNotEmpty(name, "relativePath");
+ CheckArg.isNotEmpty(name, "relativePath");
int childNdx = 0;
if (children != null) {
for (Name child : children) {
@@ -461,7 +461,7 @@
* @see javax.jcr.Node#hasProperty(java.lang.String)
*/
public final boolean hasProperty( String relativePath ) throws RepositoryException {
- ArgCheck.isNotEmpty(relativePath, "relativePath");
+ CheckArg.isNotEmpty(relativePath, "relativePath");
if (relativePath.indexOf('/') >= 0) {
return (getProperty(relativePath) != null);
}
@@ -532,7 +532,7 @@
*/
@Override
public final boolean isSame( Item otherItem ) throws RepositoryException {
- ArgCheck.isNotNull(otherItem, "otherItem");
+ CheckArg.isNotNull(otherItem, "otherItem");
if (super.isSame(otherItem) && otherItem instanceof Node) {
if (otherItem instanceof AbstractJcrNode) {
return
getInternalUuid().equals(((AbstractJcrNode)otherItem).getInternalUuid());
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrProperty.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrProperty.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrProperty.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -35,7 +35,7 @@
import javax.jcr.Session;
import javax.jcr.Value;
import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.properties.Name;
import org.jboss.dna.graph.properties.Path;
@@ -69,7 +69,7 @@
* @see javax.jcr.Item#accept(javax.jcr.ItemVisitor)
*/
public final void accept( ItemVisitor visitor ) throws RepositoryException {
- ArgCheck.isNotNull(visitor, "visitor");
+ CheckArg.isNotNull(visitor, "visitor");
visitor.visit(this);
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeIterator.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeIterator.java 2008-09-18 18:00:04
UTC (rev 534)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrNodeIterator.java 2008-09-18 18:12:00
UTC (rev 535)
@@ -27,7 +27,7 @@
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.Name;
/**
@@ -133,7 +133,7 @@
* @see javax.jcr.RangeIterator#skip(long)
*/
public void skip( long count ) {
- ArgCheck.isNonNegative(count, "count");
+ CheckArg.isNonNegative(count, "count");
while (--count >= 0) {
nextNode();
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrProperty.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrProperty.java 2008-09-18 18:00:04 UTC
(rev 534)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrProperty.java 2008-09-18 18:12:00 UTC
(rev 535)
@@ -172,7 +172,7 @@
*
@SuppressWarnings( "fallthrough" )
public void setValue( Value value ) throws RepositoryException {
- ArgCheck.isNotNull(value, "value");
+ CheckArg.isNotNull(value, "value");
// TODOx: Check node type constraint
try {
jcrValue = JcrValue.class.cast(value);
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrPropertyIterator.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrPropertyIterator.java 2008-09-18
18:00:04 UTC (rev 534)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrPropertyIterator.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -25,7 +25,7 @@
import java.util.Set;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
/**
* @author jverhaeg
@@ -105,7 +105,7 @@
* @see javax.jcr.RangeIterator#skip(long)
*/
public void skip( long count ) {
- ArgCheck.isNonNegative(count, "count");
+ CheckArg.isNonNegative(count, "count");
while (--count >= 0) {
nextProperty();
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2008-09-18 18:00:04
UTC (rev 534)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrRepository.java 2008-09-18 18:12:00
UTC (rev 535)
@@ -36,7 +36,7 @@
import javax.jcr.SimpleCredentials;
import javax.security.auth.login.LoginContext;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.connectors.RepositoryConnectionFactory;
@@ -101,8 +101,8 @@
public JcrRepository( Map<String, String> descriptors,
ExecutionContextFactory executionContextFactory,
RepositoryConnectionFactory connectionFactory ) {
- ArgCheck.isNotNull(executionContextFactory,
"executionContextFactory");
- ArgCheck.isNotNull(connectionFactory, "connectionFactory");
+ CheckArg.isNotNull(executionContextFactory,
"executionContextFactory");
+ CheckArg.isNotNull(connectionFactory, "connectionFactory");
this.executionContextFactory = executionContextFactory;
this.connectionFactory = connectionFactory;
Map<String, String> modifiableDescriptors;
@@ -146,7 +146,7 @@
* @see javax.jcr.Repository#getDescriptor(java.lang.String)
*/
public String getDescriptor( String key ) {
- ArgCheck.isNotEmpty(key, "key");
+ CheckArg.isNotEmpty(key, "key");
return descriptors.get(key);
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java 2008-09-18 18:00:04 UTC
(rev 534)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrSession.java 2008-09-18 18:12:00 UTC
(rev 535)
@@ -45,7 +45,7 @@
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.StringUtil;
import org.jboss.dna.graph.DnaLexicon;
import org.jboss.dna.graph.ExecutionContext;
@@ -115,8 +115,8 @@
*/
public void checkPermission( String path,
String actions ) {
- ArgCheck.isNotEmpty(path, "path");
- ArgCheck.isNotEmpty(actions, "actions");
+ CheckArg.isNotEmpty(path, "path");
+ CheckArg.isNotEmpty(actions, "actions");
if (!"read".equals(actions)) {
throw new AccessControlException(JcrI18n.permissionDenied.text(path,
actions));
}
@@ -226,7 +226,7 @@
* @see javax.jcr.Session#getItem(java.lang.String)
*/
public Item getItem( String absolutePath ) throws RepositoryException {
- ArgCheck.isNotEmpty(absolutePath, "absolutePath");
+ CheckArg.isNotEmpty(absolutePath, "absolutePath");
// Return root node if path is "/"
Path path =
executionContext.getValueFactories().getPathFactory().create(absolutePath);
if (path.isRoot()) {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryLibrary.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -32,7 +32,7 @@
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.ExecutionContextFactory;
import org.jboss.dna.graph.connectors.BasicExecutionContextFactory;
@@ -144,7 +144,7 @@
*/
public RepositoryLibrary( ExecutionContextFactory executionContextFactory,
RepositoryConnectionFactory delegate ) {
- ArgCheck.isNotNull(executionContextFactory,
"executionContextFactory");
+ CheckArg.isNotNull(executionContextFactory,
"executionContextFactory");
this.delegate = delegate;
this.executionContextFactory = executionContextFactory;
this.repositoryContext = new RepositoryContext() {
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/RepositoryService.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -31,7 +31,7 @@
import org.jboss.dna.common.collection.SimpleProblems;
import org.jboss.dna.common.component.ClassLoaderFactory;
import org.jboss.dna.common.component.StandardClassLoaderFactory;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Reflection;
import org.jboss.dna.connector.federation.FederationException;
import org.jboss.dna.graph.DnaLexicon;
@@ -147,9 +147,9 @@
Path pathToConfigurationRoot,
ExecutionContext context,
ClassLoaderFactory classLoaderFactory ) {
- ArgCheck.isNotNull(configurationSourceName,
"configurationSourceName");
- ArgCheck.isNotNull(sources, "sources");
- ArgCheck.isNotNull(context, "context");
+ CheckArg.isNotNull(configurationSourceName,
"configurationSourceName");
+ CheckArg.isNotNull(sources, "sources");
+ CheckArg.isNotNull(context, "context");
if (pathToConfigurationRoot == null) pathToConfigurationRoot =
context.getValueFactories().getPathFactory().create("/dna:system");
this.sources = sources;
this.pathToConfigurationRoot = pathToConfigurationRoot;
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/observation/ObservationService.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -41,7 +41,7 @@
import javax.jcr.observation.ObservationManager;
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.repository.RepositoryI18n;
import org.jboss.dna.repository.services.AbstractServiceAdministrator;
@@ -141,7 +141,7 @@
private final Administrator administrator = new Administrator();
public ObservationService( SessionFactory sessionFactory ) {
- ArgCheck.isNotNull(sessionFactory, "session factory");
+ CheckArg.isNotNull(sessionFactory, "session factory");
this.sessionFactory = sessionFactory;
}
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleService.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -52,7 +52,7 @@
import org.jboss.dna.common.SystemFailureException;
import org.jboss.dna.common.component.ClassLoaderFactory;
import org.jboss.dna.common.component.StandardClassLoaderFactory;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.common.util.StringUtil;
import org.jboss.dna.repository.RepositoryI18n;
@@ -194,7 +194,7 @@
* @see #removeRuleSet(String)
*/
public boolean addRuleSet( RuleSet ruleSet ) {
- ArgCheck.isNotNull(ruleSet, "rule set");
+ CheckArg.isNotNull(ruleSet, "rule set");
final String providerUri = ruleSet.getProviderUri();
final String ruleSetName = ruleSet.getName();
final String rules = ruleSet.getRules();
@@ -304,7 +304,7 @@
* @see #updateRuleSet(RuleSet)
*/
public boolean removeRuleSet( String ruleSetName ) {
- ArgCheck.isNotEmpty(ruleSetName, "rule set");
+ CheckArg.isNotEmpty(ruleSetName, "rule set");
try {
this.lock.writeLock().lock();
RuleSet ruleSet = this.ruleSets.remove(ruleSetName);
@@ -358,7 +358,7 @@
* {@link RuleSet#getProviderUri() RuleSet's provider URI}.
*/
public List<?> executeRules( String ruleSetName, Map<String, Object>
globals, Object... facts ) {
- ArgCheck.isNotEmpty(ruleSetName, "rule set name");
+ CheckArg.isNotEmpty(ruleSetName, "rule set name");
List<?> result = null;
List<?> factList = Arrays.asList(facts);
try {
Modified: trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSet.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSet.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSet.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -33,7 +33,7 @@
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.component.ClassLoaderFactory;
import org.jboss.dna.common.component.ComponentConfig;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
/**
* A description of a set of rules compatible with a JSR-94 rule engine.
@@ -64,9 +64,9 @@
public RuleSet( String name, String description, String classname, String[]
classpath, String providerUri, String ruleSetUri, String rules, Map<String, Object>
properties ) {
super(name, description, System.currentTimeMillis(), classname, classpath);
if (ruleSetUri == null) ruleSetUri = name.trim();
- ArgCheck.isNotEmpty(ruleSetUri, "rule set URI");
- ArgCheck.isNotEmpty(providerUri, "provider URI");
- ArgCheck.isNotEmpty(rules, "rules");
+ CheckArg.isNotEmpty(ruleSetUri, "rule set URI");
+ CheckArg.isNotEmpty(providerUri, "provider URI");
+ CheckArg.isNotEmpty(rules, "rules");
this.providerUri = providerUri;
this.ruleSetUri = ruleSetUri;
this.rules = rules;
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/rules/RuleSetRepositoryMonitor.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -35,7 +35,7 @@
import javax.jcr.Session;
import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.collection.SimpleProblems;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.repository.RepositoryI18n;
import org.jboss.dna.repository.observation.NodeChange;
@@ -85,8 +85,8 @@
public RuleSetRepositoryMonitor( RuleService ruleService,
String jcrAbsolutePath,
JcrExecutionContext executionContext ) {
- ArgCheck.isNotNull(ruleService, "rule service");
- ArgCheck.isNotNull(executionContext, "execution context");
+ CheckArg.isNotNull(ruleService, "rule service");
+ CheckArg.isNotNull(executionContext, "execution context");
this.ruleService = ruleService;
this.executionContext = executionContext;
this.executorService = Executors.newSingleThreadExecutor();
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerNodeContext.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerNodeContext.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerNodeContext.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -32,7 +32,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.Value;
import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.properties.Name;
import org.jboss.dna.graph.properties.NamespaceRegistry;
@@ -164,7 +164,7 @@
* @see
org.jboss.dna.graph.sequencers.SequencerContext#getInputProperty(org.jboss.dna.graph.properties.Name)
*/
public Property getInputProperty( Name name ) {
- ArgCheck.isNotNull(name, "name");
+ CheckArg.isNotNull(name, "name");
for (Property prop : props) {
if (name.equals(prop.getName())) {
return prop;
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerOutputMap.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerOutputMap.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerOutputMap.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -30,7 +30,7 @@
import java.util.Map;
import net.jcip.annotations.Immutable;
import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.StringUtil;
import org.jboss.dna.graph.properties.Name;
import org.jboss.dna.graph.properties.NameFactory;
@@ -57,7 +57,7 @@
private final Name jcrName;
public SequencerOutputMap( ValueFactories factories ) {
- ArgCheck.isNotNull(factories, "factories");
+ CheckArg.isNotNull(factories, "factories");
this.data = new HashMap<Path, List<PropertyValue>>();
this.factories = factories;
this.jcrName = this.factories.getNameFactory().create(JCR_NAME_PROPERTY_NAME);
@@ -87,8 +87,8 @@
public void setProperty( Path nodePath,
Name propertyName,
Object... values ) {
- ArgCheck.isNotNull(nodePath, "nodePath");
- ArgCheck.isNotNull(propertyName, "property");
+ CheckArg.isNotNull(nodePath, "nodePath");
+ CheckArg.isNotNull(propertyName, "property");
// Ignore the "jcr:name" property, as that's handled by the path ...
if (this.jcrName.equals(propertyName)) return;
@@ -115,8 +115,8 @@
public void setProperty( String nodePath,
String property,
Object... values ) {
- ArgCheck.isNotEmpty(nodePath, "nodePath");
- ArgCheck.isNotEmpty(property, "property");
+ CheckArg.isNotEmpty(nodePath, "nodePath");
+ CheckArg.isNotEmpty(property, "property");
Path path = this.factories.getPathFactory().create(nodePath);
Name propertyName = this.factories.getNameFactory().create(property);
setProperty(path, propertyName, values);
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerPathExpression.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerPathExpression.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencerPathExpression.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -26,7 +26,7 @@
import java.util.Map;
import java.util.regex.Pattern;
import net.jcip.annotations.Immutable;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.graph.properties.PathExpression;
import org.jboss.dna.repository.RepositoryI18n;
@@ -80,7 +80,7 @@
* @throws InvalidSequencerPathExpression if the expression is blank or is not a
valid expression
*/
public static final SequencerPathExpression compile( String expression ) throws
InvalidSequencerPathExpression {
- ArgCheck.isNotNull(expression, "sequencer path expression");
+ CheckArg.isNotNull(expression, "sequencer path expression");
expression = expression.trim();
if (expression.length() == 0) {
throw new
InvalidSequencerPathExpression(RepositoryI18n.pathExpressionMayNotBeBlank.text());
@@ -100,7 +100,7 @@
protected SequencerPathExpression( PathExpression selectExpression,
String outputExpression ) throws
InvalidSequencerPathExpression {
- ArgCheck.isNotNull(selectExpression, "select expression");
+ CheckArg.isNotNull(selectExpression, "select expression");
this.selectExpression = selectExpression;
this.outputExpression = outputExpression != null ? outputExpression.trim() :
DEFAULT_OUTPUT_EXPRESSION;
this.hc = HashCode.compute(this.selectExpression, this.outputExpression);
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/sequencers/SequencingService.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -49,7 +49,7 @@
import org.jboss.dna.common.monitor.LoggingProgressMonitor;
import org.jboss.dna.common.monitor.ProgressMonitor;
import org.jboss.dna.common.monitor.SimpleProgressMonitor;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.properties.NamespaceRegistry;
@@ -326,7 +326,7 @@
* @param executionContext Sets executionContext to the specified value.
*/
public void setExecutionContext( JcrExecutionContext executionContext ) {
- ArgCheck.isNotNull(executionContext, "execution context");
+ CheckArg.isNotNull(executionContext, "execution context");
if (this.getAdministrator().isStarted()) {
throw new
IllegalStateException(RepositoryI18n.unableToChangeExecutionContextWhileRunning.text());
}
@@ -361,7 +361,7 @@
* @see
Executors#newSingleThreadScheduledExecutor(java.util.concurrent.ThreadFactory)
*/
public void setExecutorService( ExecutorService executorService ) {
- ArgCheck.isNotNull(executorService, "executor service");
+ CheckArg.isNotNull(executorService, "executor service");
if (this.getAdministrator().isStarted()) {
throw new
IllegalStateException(RepositoryI18n.unableToChangeExecutionContextWhileRunning.text());
}
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/AbstractSessionFactory.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/AbstractSessionFactory.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/AbstractSessionFactory.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -30,7 +30,7 @@
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
import org.jboss.dna.common.SystemFailureException;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
/**
* A SessionFactory implementation that creates {@link Session} instances using {@link
Repository} instances.
@@ -174,7 +174,7 @@
* {@inheritDoc}
*/
public Session createSession( String name ) throws RepositoryException {
- ArgCheck.isNotNull(name, "session name");
+ CheckArg.isNotNull(name, "session name");
name = name.trim();
// Look up the Repository object in JNDI ...
String repositoryName = getRepositoryName(name);
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/BasicJcrExecutionContext.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/BasicJcrExecutionContext.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/BasicJcrExecutionContext.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -21,7 +21,7 @@
*/
package org.jboss.dna.repository.util;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.connectors.BasicExecutionContext;
import org.jboss.dna.graph.properties.NamespaceRegistry;
import org.jboss.dna.graph.properties.PropertyFactory;
@@ -50,7 +50,7 @@
ValueFactories valueFactories,
PropertyFactory propertyFactory ) {
super(namespaceRegistry, valueFactories, propertyFactory);
- ArgCheck.isNotNull(sessionFactory, "session factory");
+ CheckArg.isNotNull(sessionFactory, "session factory");
this.sessionFactory = sessionFactory;
}
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrNamespaceRegistry.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrNamespaceRegistry.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JcrNamespaceRegistry.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -26,7 +26,7 @@
import java.util.Set;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.properties.NamespaceException;
import org.jboss.dna.graph.properties.NamespaceRegistry;
@@ -39,8 +39,8 @@
private final SessionFactory sessionFactory;
public JcrNamespaceRegistry( SessionFactory sessionFactory, String
repositoryWorkspaceName ) {
- ArgCheck.isNotNull(sessionFactory, "sessionFactory");
- ArgCheck.isNotNull(repositoryWorkspaceName,
"repositoryWorkspaceName");
+ CheckArg.isNotNull(sessionFactory, "sessionFactory");
+ CheckArg.isNotNull(repositoryWorkspaceName,
"repositoryWorkspaceName");
this.repositoryWorkspaceName = repositoryWorkspaceName;
this.sessionFactory = sessionFactory;
}
Modified:
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JndiSessionFactory.java
===================================================================
---
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JndiSessionFactory.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/dna-repository/src/main/java/org/jboss/dna/repository/util/JndiSessionFactory.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -29,7 +29,7 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.dna.common.SystemFailureException;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.repository.RepositoryI18n;
/**
@@ -96,7 +96,7 @@
*/
public JndiSessionFactory( Context context, char... workspaceDelimiters ) {
super(workspaceDelimiters);
- ArgCheck.isNotNull(context, "initial context");
+ CheckArg.isNotNull(context, "initial context");
this.context = context;
}
Modified:
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
===================================================================
---
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -40,7 +40,7 @@
import org.jboss.dna.common.component.ClassLoaderFactory;
import org.jboss.dna.common.component.StandardClassLoaderFactory;
import org.jboss.dna.common.text.NoOpEncoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.connector.inmemory.InMemoryRepositorySource;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.ExecutionContextFactory;
@@ -370,7 +370,7 @@
private final LoginContext context;
public JaasCredentials( LoginContext context ) {
- ArgCheck.isNotNull(context, "context");
+ CheckArg.isNotNull(context, "context");
this.context = context;
}
Modified: trunk/eclipse-preferences.epf
===================================================================
--- trunk/eclipse-preferences.epf 2008-09-18 18:00:04 UTC (rev 534)
+++ trunk/eclipse-preferences.epf 2008-09-18 18:12:00 UTC (rev 535)
@@ -72,7 +72,7 @@
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
/instance/org.eclipse.jdt.core/org.eclipse.jdt.core.compiler.source=1.5
-/instance/org.eclipse.jdt.ui/content_assist_favorite_static_members=org.junit.Assert.*;org.hamcrest.core.IsEqual.*;org.junit.matchers.JUnitMatchers.*;org.hamcrest.core.AllOf.*;org.hamcrest.core.AnyOf.*;org.hamcrest.core.IsInstanceOf.*;org.hamcrest.core.IsNot.*;org.hamcrest.core.IsNull.*;org.hamcrest.core.IsSame.*;org.hamcrest.core.DescribedAs.*;org.junit.matchers.IsCollectionContaining.*;org.junit.matchers.StringContains.*;org.hamcrest.core.Is.is;org.hamcrest.core.IsNot.not;org.hamcrest.core.IsNull.nullValue;org.hamcrest.core.IsNull.notNullValue;org.hamcrest.core.IsSame.sameInstance;org.hamcrest.core.IsInstanceOf.instanceOf;org.hamcrest.core.IsEqual.equalTo;org.hamcrest.core.IsAnything.anything;org.hamcrest.core.IsAnything.any;org.hamcrest.core.DescribedAs.describedAs;org.hamcrest.core.AnyOf.anyOf;org.hamcrest.core.AllOf.allOf;org.junit.matchers.IsCollectionContaining.hasItem;org.junit.matchers.IsCollectionContaining.hasItems;org.junit.matchers.Each.each;org.junit.matchers.!
JUnitMatchers.hasItem;org.junit.matchers.JUnitMatchers.hasItems;org.junit.matchers.JUnitMatchers.containsString;org.junit.matchers.JUnitMatchers.each;org.junit.matchers.JUnitMatchers.both;org.junit.matchers.JUnitMatchers.either;org.junit.matchers.StringContains.containsString;org.junit.matchers.TypeSafeMatcher.matches;org.hamcrest.collection.IsArray.*;org.hamcrest.collection.IsArrayContaining.*;org.hamcrest.number.IsCloseTo.*;org.mockito.Mockito.mock;org.mockito.Mockito.stub;org.mockito.Mockito.verify;org.mockito.Mockito.atLeastOnce;org.mockito.Mockito.inOrder;org.mockito.Mockito.never;org.mockito.Mockito.stubVoid;org.mockito.Mockito.times;org.mockito.Matchers;org.mockito.Matchers.anyBoolean;org.mockito.Matchers.anyByte;org.mockito.Matchers.anyChar;org.mockito.Matchers.anyDouble;org.mockito.Matchers.anyFloat;org.mockito.Matchers.anyInt;org.mockito.Matchers.anyLong;org.mockito.Matchers.anyObject;org.mockito.Matchers.anyShort;org.mockito.Matchers.anyString;org.mockito.Matcher!
s.argThat;org.mockito.Matchers.booleanThat;org.mockito.Matchers.byteTh
at;org.mockito.Matchers.charThat;org.mockito.Matchers.contains;org.mockito.Matchers.doubleThat;org.mockito.Matchers.endsWith;org.mockito.Matchers.eq;org.mockito.Matchers.floatThat;org.mockito.Matchers.intThat;org.mockito.Matchers.isA;org.mockito.Matchers.isNull;org.mockito.Matchers.longThat;org.mockito.Matchers.matches;org.mockito.Matchers.notNull;org.mockito.Matchers.refEq;org.mockito.Matchers.same;org.mockito.Matchers.shortThat;org.mockito.Matchers.startsWith;org.jboss.dna.common.text.StringMatcher.startsWith;org.jboss.dna.spi.graph.connection.RepositorySourceLoadHarness.runLoadTest;org.mockito.Mockito.verifyNoMoreInteractions;org.mockito.Mockito.verifyZeroInteractions;org.jboss.dna.common.collection.IsIteratorContaining.hasItems;org.jboss.dna.common.collection.IsIteratorContaining.hasItem.*;org.mockito.Mockito.doReturn;org.mockito.Mockito.doThrow;org.mockito.Mockito.doAnswer;org.mockito.Mockito.doNothing;org.mockito.Mockito.anyList;org.mockito.Mockito.anyMap;org.mockito.M!
ockito.anyCollection;org.mockito.Mockito.spy
+/instance/org.eclipse.jdt.ui/content_assist_favorite_static_members=org.junit.Assert.*;org.hamcrest.core.IsEqual.*;org.junit.matchers.JUnitMatchers.*;org.hamcrest.core.AllOf.*;org.hamcrest.core.AnyOf.*;org.hamcrest.core.IsInstanceOf.*;org.hamcrest.core.IsNot.*;org.hamcrest.core.IsNull.*;org.hamcrest.core.IsSame.*;org.hamcrest.core.DescribedAs.*;org.junit.matchers.IsCollectionContaining.*;org.junit.matchers.StringContains.*;org.hamcrest.core.Is.is;org.hamcrest.core.IsNot.not;org.hamcrest.core.IsNull.nullValue;org.hamcrest.core.IsNull.notNullValue;org.hamcrest.core.IsSame.sameInstance;org.hamcrest.core.IsInstanceOf.instanceOf;org.hamcrest.core.IsEqual.equalTo;org.hamcrest.core.IsAnything.anything;org.hamcrest.core.IsAnything.any;org.hamcrest.core.DescribedAs.describedAs;org.hamcrest.core.AnyOf.anyOf;org.hamcrest.core.AllOf.allOf;org.junit.matchers.IsCollectionContaining.hasItem;org.junit.matchers.IsCollectionContaining.hasItems;org.junit.matchers.Each.each;org.junit.matchers.!
JUnitMatchers.hasItem;org.junit.matchers.JUnitMatchers.hasItems;org.junit.matchers.JUnitMatchers.containsString;org.junit.matchers.JUnitMatchers.each;org.junit.matchers.JUnitMatchers.both;org.junit.matchers.JUnitMatchers.either;org.junit.matchers.StringContains.containsString;org.junit.matchers.TypeSafeMatcher.matches;org.hamcrest.collection.IsArray.*;org.hamcrest.collection.IsArrayContaining.*;org.hamcrest.number.IsCloseTo.*;org.mockito.Mockito.mock;org.mockito.Mockito.stub;org.mockito.Mockito.verify;org.mockito.Mockito.atLeastOnce;org.mockito.Mockito.inOrder;org.mockito.Mockito.never;org.mockito.Mockito.stubVoid;org.mockito.Mockito.times;org.mockito.Matchers;org.mockito.Matchers.anyBoolean;org.mockito.Matchers.anyByte;org.mockito.Matchers.anyChar;org.mockito.Matchers.anyDouble;org.mockito.Matchers.anyFloat;org.mockito.Matchers.anyInt;org.mockito.Matchers.anyLong;org.mockito.Matchers.anyObject;org.mockito.Matchers.anyShort;org.mockito.Matchers.anyString;org.mockito.Matcher!
s.argThat;org.mockito.Matchers.booleanThat;org.mockito.Matchers.byteTh
at;org.mockito.Matchers.charThat;org.mockito.Matchers.contains;org.mockito.Matchers.doubleThat;org.mockito.Matchers.endsWith;org.mockito.Matchers.eq;org.mockito.Matchers.floatThat;org.mockito.Matchers.intThat;org.mockito.Matchers.isA;org.mockito.Matchers.isNull;org.mockito.Matchers.longThat;org.mockito.Matchers.matches;org.mockito.Matchers.notNull;org.mockito.Matchers.refEq;org.mockito.Matchers.same;org.mockito.Matchers.shortThat;org.mockito.Matchers.startsWith;org.jboss.dna.common.text.StringMatcher.startsWith;org.jboss.dna.graph.connectors.RepositorySourceLoadHarness.runLoadTest;org.mockito.Mockito.verifyNoMoreInteractions;org.mockito.Mockito.verifyZeroInteractions;org.jboss.dna.common.collection.IsIteratorContaining.hasItems;org.jboss.dna.common.collection.IsIteratorContaining.hasItem.*;org.mockito.Mockito.doReturn;org.mockito.Mockito.doThrow;org.mockito.Mockito.doAnswer;org.mockito.Mockito.doNothing;org.mockito.Mockito.anyList;org.mockito.Mockito.anyMap;org.mockito.Mocki!
to.anyCollection;org.mockito.Mockito.spy
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.gettersetter.use.is=true
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.ignorelowercasenames=true
/instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.importorder=\#;java;javax;org;com;
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenDependency.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenDependency.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenDependency.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -24,7 +24,7 @@
import java.util.EnumSet;
import java.util.LinkedHashSet;
import java.util.Set;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
/**
* The cornerstone of Maven is its dependency list. Most every project depends upon
others to build and run correctly, and if all
@@ -89,7 +89,7 @@
}
public MavenDependency( MavenId id ) {
- ArgCheck.isNotNull(id, "id");
+ CheckArg.isNotNull(id, "id");
this.id = id;
}
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenId.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenId.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenId.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -27,7 +27,7 @@
import java.util.regex.Pattern;
import org.jboss.dna.common.text.TextEncoder;
import org.jboss.dna.common.text.NoOpEncoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.common.util.StringUtil;
@@ -110,9 +110,9 @@
* @throws IllegalArgumentException if the supplied string is null or if the string
does not match the expected format
*/
public MavenId( String coordinates ) {
- ArgCheck.isNotNull(coordinates, "coordinates");
+ CheckArg.isNotNull(coordinates, "coordinates");
coordinates = coordinates.trim();
- ArgCheck.isNotEmpty(coordinates, "coordinates");
+ CheckArg.isNotEmpty(coordinates, "coordinates");
// This regular expression has the following groups:
// 1) groupId
@@ -131,8 +131,8 @@
String artifactId = matcher.group(3);
String version = matcher.group(5);
String classifier = matcher.group(7);
- ArgCheck.isNotEmpty(groupId, "groupId");
- ArgCheck.isNotEmpty(artifactId, "artifactId");
+ CheckArg.isNotEmpty(groupId, "groupId");
+ CheckArg.isNotEmpty(artifactId, "artifactId");
this.groupId = groupId.trim();
this.artifactId = artifactId.trim();
this.classifier = classifier != null ? classifier.trim() : "";
@@ -169,8 +169,8 @@
* @throws IllegalArgumentException if the group or artifact identifiers are null,
empty or blank
*/
public MavenId( String groupId, String artifactId, String version, String classifier
) {
- ArgCheck.isNotEmpty(groupId, "groupId");
- ArgCheck.isNotEmpty(artifactId, "artifactId");
+ CheckArg.isNotEmpty(groupId, "groupId");
+ CheckArg.isNotEmpty(artifactId, "artifactId");
this.groupId = groupId.trim();
this.artifactId = artifactId.trim();
this.classifier = classifier != null ? classifier.trim() : "";
Modified:
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepository.java
===================================================================
---
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepository.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-classloader-maven/src/main/java/org/jboss/dna/maven/MavenRepository.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -43,7 +43,7 @@
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.jboss.dna.common.component.ClassLoaderFactory;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.common.xml.SimpleNamespaceContext;
import org.jboss.dna.maven.spi.JcrMavenUrlProvider;
@@ -73,7 +73,7 @@
private final Logger logger;
public MavenRepository( final MavenUrlProvider urlProvider ) {
- ArgCheck.isNotNull(urlProvider, "urlProvider");
+ CheckArg.isNotNull(urlProvider, "urlProvider");
this.urlProvider = urlProvider;
this.classLoaders = new MavenClassLoaders(this);
this.logger = Logger.getLogger(this.getClass());
@@ -94,8 +94,8 @@
* @throws IllegalArgumentException if no Maven IDs are passed in or if any of the
IDs are null
*/
public ClassLoader getClassLoader( ClassLoader parent, MavenId... mavenIds ) {
- ArgCheck.isNotEmpty(mavenIds, "mavenIds");
- ArgCheck.containsNoNulls(mavenIds, "mavenIds");
+ CheckArg.isNotEmpty(mavenIds, "mavenIds");
+ CheckArg.containsNoNulls(mavenIds, "mavenIds");
return this.classLoaders.getClassLoader(parent, mavenIds);
}
@@ -121,8 +121,8 @@
* @throws IllegalArgumentException if no coordinates are passed in or if any of the
coordinate references is null
*/
public ClassLoader getClassLoader( ClassLoader parent, String... coordinates ) {
- ArgCheck.isNotEmpty(coordinates, "coordinates");
- ArgCheck.containsNoNulls(coordinates, "coordinates");
+ CheckArg.isNotEmpty(coordinates, "coordinates");
+ CheckArg.containsNoNulls(coordinates, "coordinates");
MavenId[] mavenIds = new MavenId[coordinates.length];
for (int i = 0; i < coordinates.length; i++) {
String coordinate = coordinates[i];
@@ -212,8 +212,8 @@
* @throws MavenRepositoryException if there is a problem reading the POM file given
the supplied stream and MavenId
*/
protected List<MavenDependency> getDependencies( MavenId mavenId, InputStream
pomStream, MavenDependency.Scope... allowedScopes ) throws IOException {
- ArgCheck.isNotNull(mavenId, "mavenId");
- ArgCheck.isNotNull(pomStream, "pomStream");
+ CheckArg.isNotNull(mavenId, "mavenId");
+ CheckArg.isNotNull(pomStream, "pomStream");
EnumSet<MavenDependency.Scope> includedScopes =
MavenDependency.Scope.getRuntimeScopes();
if (allowedScopes != null && allowedScopes.length > 0) includedScopes
= EnumSet.of(allowedScopes[0], allowedScopes);
List<MavenDependency> results = new ArrayList<MavenDependency>();
Modified:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepository.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -28,7 +28,7 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.connector.federation.executor.FederatingCommandExecutor;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.commands.executor.CommandExecutor;
@@ -66,9 +66,9 @@
public FederatedRepository( ExecutionContext context,
RepositoryConnectionFactory connectionFactory,
FederatedRepositoryConfig config ) {
- ArgCheck.isNotNull(connectionFactory, "connectionFactory");
- ArgCheck.isNotNull(context, "context");
- ArgCheck.isNotNull(config, "config");
+ CheckArg.isNotNull(connectionFactory, "connectionFactory");
+ CheckArg.isNotNull(context, "context");
+ CheckArg.isNotNull(config, "config");
this.context = context;
this.connectionFactory = connectionFactory;
this.config = config;
@@ -216,7 +216,7 @@
* @throws IllegalArgumentException if the configuration is null
*/
public void setConfiguration( FederatedRepositoryConfig config ) {
- ArgCheck.isNotNull(config, "config");
+ CheckArg.isNotNull(config, "config");
this.config = config;
}
Modified:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositoryConfig.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositoryConfig.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositoryConfig.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -28,7 +28,7 @@
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.collection.Problems;
import org.jboss.dna.common.collection.ThreadSafeProblems;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.cache.CachePolicy;
import org.jboss.dna.graph.connectors.RepositorySource;
@@ -61,8 +61,8 @@
Projection cacheProjection,
Iterable<Projection> sourceProjections,
CachePolicy defaultCachePolicy ) {
- ArgCheck.isNotEmpty(repositoryName, "repositoryName");
- ArgCheck.isNotNull(cacheProjection, "cacheProjection");
+ CheckArg.isNotEmpty(repositoryName, "repositoryName");
+ CheckArg.isNotNull(cacheProjection, "cacheProjection");
this.name = repositoryName;
this.problems = new ThreadSafeProblems();
this.defaultCachePolicy = defaultCachePolicy;
@@ -75,7 +75,7 @@
}
}
this.sourceProjections = Collections.unmodifiableList(projectionList);
- ArgCheck.isNotEmpty(this.sourceProjections, "sourceProjections");
+ CheckArg.isNotEmpty(this.sourceProjections, "sourceProjections");
}
/**
Modified:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/FederatedRepositorySource.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -44,7 +44,7 @@
import org.jboss.dna.common.collection.Problems;
import org.jboss.dna.common.collection.SimpleProblems;
import org.jboss.dna.common.i18n.I18n;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.connector.federation.executor.FederatingCommandExecutor;
import org.jboss.dna.connector.federation.executor.SingleProjectionCommandExecutor;
@@ -133,7 +133,7 @@
*/
public FederatedRepositorySource( String repositoryName ) {
super();
- ArgCheck.isNotNull(repositoryName, "repositoryName");
+ CheckArg.isNotNull(repositoryName, "repositoryName");
this.repositoryName = repositoryName;
}
@@ -328,7 +328,7 @@
* @see #setName(String)
*/
public synchronized void setRepositoryName( String repositoryName ) {
- ArgCheck.isNotEmpty(repositoryName, "repositoryName");
+ CheckArg.isNotEmpty(repositoryName, "repositoryName");
if (this.repositoryName != null &&
this.repositoryName.equals(repositoryName)) return; // unchanged
this.repositoryName = repositoryName;
changeRepositoryConfig();
Modified:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/Projection.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/Projection.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/Projection.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -35,7 +35,7 @@
import java.util.regex.Pattern;
import net.jcip.annotations.Immutable;
import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.graph.ExecutionContext;
@@ -106,9 +106,9 @@
public static void addRuleParser( ClassLoader classLoader,
String className,
String methodName ) throws SecurityException,
NoSuchMethodException, ClassNotFoundException {
- ArgCheck.isNotNull(classLoader, "classLoader");
- ArgCheck.isNotEmpty(className, "className");
- ArgCheck.isNotEmpty(methodName, "methodName");
+ CheckArg.isNotNull(classLoader, "classLoader");
+ CheckArg.isNotEmpty(className, "className");
+ CheckArg.isNotEmpty(methodName, "methodName");
Class<?> clazz = Class.forName(className, true, classLoader);
parserMethods.add(clazz.getMethod(className, String.class,
ExecutionContext.class));
}
@@ -134,8 +134,8 @@
*/
public static boolean removeRuleParser( String declaringClassName,
String methodName ) {
- ArgCheck.isNotEmpty(declaringClassName, "declaringClassName");
- ArgCheck.isNotEmpty(methodName, "methodName");
+ CheckArg.isNotEmpty(declaringClassName, "declaringClassName");
+ CheckArg.isNotEmpty(methodName, "methodName");
for (Method method : parserMethods) {
if (method.getName().equals(methodName) &&
method.getDeclaringClass().getName().equals(declaringClassName)) {
return parserMethods.remove(method);
@@ -153,7 +153,7 @@
*/
public static Rule fromString( String definition,
ExecutionContext context ) {
- ArgCheck.isNotNull(context, "env");
+ CheckArg.isNotNull(context, "env");
definition = definition != null ? definition.trim() : "";
if (definition.length() == 0) return null;
for (Method method : parserMethods) {
@@ -243,15 +243,15 @@
*/
public Projection( String sourceName,
Rule... rules ) {
- ArgCheck.isNotEmpty(sourceName, "sourceName");
- ArgCheck.isNotEmpty(rules, "rules");
+ CheckArg.isNotEmpty(sourceName, "sourceName");
+ CheckArg.isNotEmpty(rules, "rules");
this.sourceName = sourceName;
List<Rule> rulesList = new ArrayList<Rule>();
for (Rule rule : rules) {
if (rule != null) rulesList.add(rule);
}
this.rules = Collections.unmodifiableList(rulesList);
- ArgCheck.isNotEmpty(this.rules, "rules");
+ CheckArg.isNotEmpty(this.rules, "rules");
this.simple = computeSimpleProjection(this.rules);
}
@@ -286,7 +286,7 @@
*/
public Set<Path> getPathsInSource( Path canonicalPathInRepository,
PathFactory factory ) {
- ArgCheck.isNotNull(factory, "factory");
+ CheckArg.isNotNull(factory, "factory");
assert canonicalPathInRepository == null ? true :
canonicalPathInRepository.equals(canonicalPathInRepository.getCanonicalPath());
Set<Path> paths = new HashSet<Path>();
for (Rule rule : getRules()) {
@@ -308,7 +308,7 @@
*/
public Set<Path> getPathsInRepository( Path canonicalPathInSource,
PathFactory factory ) {
- ArgCheck.isNotNull(factory, "factory");
+ CheckArg.isNotNull(factory, "factory");
assert canonicalPathInSource == null ? true :
canonicalPathInSource.equals(canonicalPathInSource.getCanonicalPath());
Set<Path> paths = new HashSet<Path>();
for (Rule rule : getRules()) {
@@ -325,7 +325,7 @@
* @return the list of top-level paths, in the proper order and containing no
duplicates; never null
*/
public List<Path> getTopLevelPathsInRepository( PathFactory factory ) {
- ArgCheck.isNotNull(factory, "factory");
+ CheckArg.isNotNull(factory, "factory");
List<Rule> rules = getRules();
Set<Path> uniquePaths = new HashSet<Path>();
List<Path> paths = new ArrayList<Path>(rules.size());
Modified:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/ProjectionParser.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/ProjectionParser.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/ProjectionParser.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -27,7 +27,7 @@
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.jboss.dna.common.text.TextEncoder;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.common.util.StringUtil;
import org.jboss.dna.connector.federation.Projection.Rule;
@@ -99,8 +99,8 @@
*/
public void addRuleParser( Class<?> clazz,
String methodName ) throws SecurityException,
NoSuchMethodException {
- ArgCheck.isNotNull(clazz, "clazz");
- ArgCheck.isNotEmpty(methodName, "methodName");
+ CheckArg.isNotNull(clazz, "clazz");
+ CheckArg.isNotEmpty(methodName, "methodName");
parserMethods.add(clazz.getMethod(methodName, String.class,
ExecutionContext.class));
}
@@ -125,9 +125,9 @@
public void addRuleParser( ClassLoader classLoader,
String className,
String methodName ) throws SecurityException,
NoSuchMethodException, ClassNotFoundException {
- ArgCheck.isNotNull(classLoader, "classLoader");
- ArgCheck.isNotEmpty(className, "className");
- ArgCheck.isNotEmpty(methodName, "methodName");
+ CheckArg.isNotNull(classLoader, "classLoader");
+ CheckArg.isNotEmpty(className, "className");
+ CheckArg.isNotEmpty(methodName, "methodName");
Class<?> clazz = Class.forName(className, true, classLoader);
parserMethods.add(clazz.getMethod(methodName, String.class,
ExecutionContext.class));
}
@@ -153,8 +153,8 @@
*/
public boolean removeRuleParser( String declaringClassName,
String methodName ) {
- ArgCheck.isNotEmpty(declaringClassName, "declaringClassName");
- ArgCheck.isNotEmpty(methodName, "methodName");
+ CheckArg.isNotEmpty(declaringClassName, "declaringClassName");
+ CheckArg.isNotEmpty(methodName, "methodName");
for (Method method : parserMethods) {
if (method.getName().equals(methodName) &&
method.getDeclaringClass().getName().equals(declaringClassName)) {
return parserMethods.remove(method);
@@ -179,7 +179,7 @@
*/
public Rule ruleFromString( String definition,
ExecutionContext context ) {
- ArgCheck.isNotNull(context, "env");
+ CheckArg.isNotNull(context, "env");
definition = definition != null ? definition.trim() : "";
if (definition.length() == 0) return null;
Logger logger = context.getLogger(getClass());
Modified:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ContributionStatistics.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ContributionStatistics.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/contribution/ContributionStatistics.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -29,7 +29,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicLong;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
/**
@@ -81,7 +81,7 @@
* @return the list of N (or fewer)
*/
public static List<Data> getTop( int n ) {
- ArgCheck.isPositive(n, "n");
+ CheckArg.isPositive(n, "n");
LinkedList<Data> results = new LinkedList<Data>();
for (Map.Entry<Stats, AtomicLong> entry : DATA.entrySet()) {
long value = entry.getValue().get();
Modified:
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MergePlan.java
===================================================================
---
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MergePlan.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-connector-federation/src/main/java/org/jboss/dna/connector/federation/merge/MergePlan.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -35,7 +35,7 @@
import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
import org.jboss.dna.common.CommonI18n;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.StringUtil;
import org.jboss.dna.connector.federation.contribution.Contribution;
import org.jboss.dna.connector.federation.contribution.EmptyContribution;
@@ -60,7 +60,7 @@
public abstract class MergePlan implements Serializable, Iterable<Contribution> {
public static MergePlan create( Contribution... contributions ) {
- ArgCheck.isNotNull(contributions, "contributions");
+ CheckArg.isNotNull(contributions, "contributions");
switch (contributions.length) {
case 0:
throw new
IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text("contributions"));
@@ -81,7 +81,7 @@
}
public static MergePlan create( Collection<Contribution> contributions ) {
- ArgCheck.isNotNull(contributions, "contributions");
+ CheckArg.isNotNull(contributions, "contributions");
Iterator<Contribution> iter = contributions.iterator();
switch (contributions.size()) {
case 0:
@@ -103,8 +103,8 @@
public static MergePlan addContribution( MergePlan plan,
Contribution contribution ) {
- ArgCheck.isNotNull(plan, "plan");
- ArgCheck.isNotNull(contribution, "contribution");
+ CheckArg.isNotNull(plan, "plan");
+ CheckArg.isNotNull(contribution, "contribution");
if (plan instanceof MultipleContributionMergePlan) {
((MultipleContributionMergePlan)plan).addContribution(contribution);
return plan;
Modified:
trunk/extensions/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepository.java
===================================================================
---
trunk/extensions/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepository.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepository.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -29,7 +29,7 @@
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import net.jcip.annotations.NotThreadSafe;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.DnaLexicon;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.commands.ActsOnPath;
@@ -65,8 +65,8 @@
public InMemoryRepository( String name,
UUID rootNodeUUID ) {
- ArgCheck.isNotNull(rootNodeUUID, "rootNodeUUID");
- ArgCheck.isNotEmpty(name, "name");
+ CheckArg.isNotNull(rootNodeUUID, "rootNodeUUID");
+ CheckArg.isNotEmpty(name, "name");
this.name = name;
this.rootNodeUuid = rootNodeUUID;
// Create the root node ...
Modified:
trunk/extensions/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepositorySource.java
===================================================================
---
trunk/extensions/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepositorySource.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-connector-inmemory/src/main/java/org/jboss/dna/connector/inmemory/InMemoryRepositorySource.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -42,7 +42,7 @@
import javax.naming.spi.ObjectFactory;
import net.jcip.annotations.GuardedBy;
import org.jboss.dna.common.i18n.I18n;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.cache.CachePolicy;
import org.jboss.dna.graph.connectors.RepositoryConnection;
import org.jboss.dna.graph.connectors.RepositoryContext;
@@ -176,7 +176,7 @@
*/
public synchronized void setJndiName( String name,
Context context ) throws NamingException {
- ArgCheck.isNotNull(name, "name");
+ CheckArg.isNotNull(name, "name");
if (context == null) context = new InitialContext();
// First register in JNDI under the new name ...
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/AbstractJavaMetadata.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -45,7 +45,7 @@
import org.eclipse.jdt.core.dom.Type;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.sequencer.java.metadata.ArrayTypeFieldMetadata;
import org.jboss.dna.sequencer.java.metadata.ClassMetadata;
import org.jboss.dna.sequencer.java.metadata.ConstructorMetadata;
@@ -431,7 +431,7 @@
* @throws IllegalArgumentException if type is null.
*/
private String getTypeName( Type type ) {
- ArgCheck.isNotNull(type, "type");
+ CheckArg.isNotNull(type, "type");
if (type.isPrimitiveType()) {
PrimitiveType primitiveType = (PrimitiveType)type;
return primitiveType.getPrimitiveTypeCode().toString();
Modified:
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java
===================================================================
---
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java 2008-09-18
18:00:04 UTC (rev 534)
+++
trunk/extensions/dna-sequencer-java/src/main/java/org/jboss/dna/sequencer/java/JavaMetadataUtil.java 2008-09-18
18:12:00 UTC (rev 535)
@@ -25,7 +25,7 @@
import java.io.InputStream;
import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.internal.compiler.util.Util;
-import org.jboss.dna.common.util.ArgCheck;
+import org.jboss.dna.common.util.CheckArg;
/**
* @author Serge Pagop
@@ -65,7 +65,7 @@
* @return a FQN of the name.
*/
public static String getName( Name name ) {
- ArgCheck.isNotNull(name, "name");
+ CheckArg.isNotNull(name, "name");
return name.getFullyQualifiedName();
}
@@ -79,8 +79,8 @@
*/
public static String createPathWithIndex( String path,
int index ) {
- ArgCheck.isNotEmpty(path, "path");
- ArgCheck.isPositive(index, "index");
+ CheckArg.isNotEmpty(path, "path");
+ CheckArg.isPositive(index, "index");
return path + "[" + index + "]";
}
@@ -92,7 +92,7 @@
* @throws IllegalArgumentException if the path is null, blank or empty
*/
public static String createPath( String path ) {
- ArgCheck.isNotEmpty(path, "path");
+ CheckArg.isNotEmpty(path, "path");
return path;
}