You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/12/04 23:30:58 UTC
[26/47] ISIS-188: normalizing file endings throughout
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisApplicationException.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisApplicationException.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisApplicationException.java
index d9e20df..3387e23 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisApplicationException.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisApplicationException.java
@@ -1,49 +1,49 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.exceptions;
-
-/**
- * Indicates an error raised by the application code.
- *
- * <p>
- * The viewer is expected to render the message within the application in a
- * user-friendly fashion.
- */
-public class IsisApplicationException extends IsisException {
-
- private static final long serialVersionUID = 1L;
-
- public IsisApplicationException() {
- super();
- }
-
- public IsisApplicationException(final String msg) {
- super(msg);
- }
-
- public IsisApplicationException(final Throwable cause) {
- super(cause);
- }
-
- public IsisApplicationException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.exceptions;
+
+/**
+ * Indicates an error raised by the application code.
+ *
+ * <p>
+ * The viewer is expected to render the message within the application in a
+ * user-friendly fashion.
+ */
+public class IsisApplicationException extends IsisException {
+
+ private static final long serialVersionUID = 1L;
+
+ public IsisApplicationException() {
+ super();
+ }
+
+ public IsisApplicationException(final String msg) {
+ super(msg);
+ }
+
+ public IsisApplicationException(final Throwable cause) {
+ super(cause);
+ }
+
+ public IsisApplicationException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisException.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisException.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisException.java
index c26f89c..b8fb515 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisException.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/IsisException.java
@@ -1,109 +1,109 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.exceptions;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.text.MessageFormat;
-
-/**
- * General exception raised by the framework, typically a system exception.
- */
-public class IsisException extends RuntimeException {
- private static final long serialVersionUID = 1L;
- private static boolean THROWABLE_SUPPORTS_CAUSE;
-
- static {
- // Java 1.4, and after, holds a cause; Java 1.1, 1.2 and .Net do not, so
- // we need to
- // do the work ourselves.
- final Class<?> c = Throwable.class;
- try {
- THROWABLE_SUPPORTS_CAUSE = c.getMethod("getCause", new Class[0]) != null;
- } catch (final Exception ignore) {
- // this should never occur in proper Java environment
- THROWABLE_SUPPORTS_CAUSE = false;
- }
- }
-
- private final Throwable cause;
-
- public IsisException() {
- super("");
- cause = null;
- }
-
- public IsisException(final String message) {
- super(message);
- cause = null;
- }
-
- public IsisException(final String messageFormat, final Object... args) {
- super(MessageFormat.format(messageFormat, args));
- cause = null;
- }
-
- public IsisException(final String message, final Throwable cause) {
- super(message);
- this.cause = cause;
- }
-
- public IsisException(final Throwable cause) {
- super(cause == null ? null : cause.toString());
- this.cause = cause;
- }
-
- @Override
- public Throwable getCause() {
- return (cause == this ? null : cause);
- }
-
- @Override
- public void printStackTrace(final PrintStream s) {
- if (THROWABLE_SUPPORTS_CAUSE) {
- super.printStackTrace(s);
- } else {
- synchronized (s) {
- super.printStackTrace(s);
- final Throwable c = getCause();
- if (c != null) {
- s.print("Root cause: ");
- c.printStackTrace(s);
- }
- }
- }
- }
-
- @Override
- public void printStackTrace(final PrintWriter s) {
- if (THROWABLE_SUPPORTS_CAUSE) {
- super.printStackTrace(s);
- } else {
- synchronized (s) {
- super.printStackTrace(s);
- final Throwable c = getCause();
- if (c != null) {
- s.println("Root cause: ");
- c.printStackTrace(s);
- }
- }
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.exceptions;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.text.MessageFormat;
+
+/**
+ * General exception raised by the framework, typically a system exception.
+ */
+public class IsisException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+ private static boolean THROWABLE_SUPPORTS_CAUSE;
+
+ static {
+ // Java 1.4, and after, holds a cause; Java 1.1, 1.2 and .Net do not, so
+ // we need to
+ // do the work ourselves.
+ final Class<?> c = Throwable.class;
+ try {
+ THROWABLE_SUPPORTS_CAUSE = c.getMethod("getCause", new Class[0]) != null;
+ } catch (final Exception ignore) {
+ // this should never occur in proper Java environment
+ THROWABLE_SUPPORTS_CAUSE = false;
+ }
+ }
+
+ private final Throwable cause;
+
+ public IsisException() {
+ super("");
+ cause = null;
+ }
+
+ public IsisException(final String message) {
+ super(message);
+ cause = null;
+ }
+
+ public IsisException(final String messageFormat, final Object... args) {
+ super(MessageFormat.format(messageFormat, args));
+ cause = null;
+ }
+
+ public IsisException(final String message, final Throwable cause) {
+ super(message);
+ this.cause = cause;
+ }
+
+ public IsisException(final Throwable cause) {
+ super(cause == null ? null : cause.toString());
+ this.cause = cause;
+ }
+
+ @Override
+ public Throwable getCause() {
+ return (cause == this ? null : cause);
+ }
+
+ @Override
+ public void printStackTrace(final PrintStream s) {
+ if (THROWABLE_SUPPORTS_CAUSE) {
+ super.printStackTrace(s);
+ } else {
+ synchronized (s) {
+ super.printStackTrace(s);
+ final Throwable c = getCause();
+ if (c != null) {
+ s.print("Root cause: ");
+ c.printStackTrace(s);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void printStackTrace(final PrintWriter s) {
+ if (THROWABLE_SUPPORTS_CAUSE) {
+ super.printStackTrace(s);
+ } else {
+ synchronized (s) {
+ super.printStackTrace(s);
+ final Throwable c = getCause();
+ if (c != null) {
+ s.println("Root cause: ");
+ c.printStackTrace(s);
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/NotYetImplementedException.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/NotYetImplementedException.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/NotYetImplementedException.java
index 211291c..dc42844 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/NotYetImplementedException.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/NotYetImplementedException.java
@@ -1,37 +1,37 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.exceptions;
-
-/**
- * Flags a method as not having been implemented yet, but is be implemented.
- */
-public class NotYetImplementedException extends IsisException {
-
- private static final long serialVersionUID = 1L;
-
- public NotYetImplementedException() {
- super("This method is not implemented yet");
- }
-
- public NotYetImplementedException(final String arg0) {
- super(arg0);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.exceptions;
+
+/**
+ * Flags a method as not having been implemented yet, but is be implemented.
+ */
+public class NotYetImplementedException extends IsisException {
+
+ private static final long serialVersionUID = 1L;
+
+ public NotYetImplementedException() {
+ super("This method is not implemented yet");
+ }
+
+ public NotYetImplementedException(final String arg0) {
+ super(arg0);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnexpectedCallException.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnexpectedCallException.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnexpectedCallException.java
index abdfae9..b1e77e5 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnexpectedCallException.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnexpectedCallException.java
@@ -1,37 +1,37 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.exceptions;
-
-/**
- * Indicates that a call was made to a method (normally an overridden one) that
- * was not expected, and hence not coded for.
- */
-public class UnexpectedCallException extends IsisException {
- private static final long serialVersionUID = 1L;
-
- public UnexpectedCallException() {
- super("This method call was not expected");
- }
-
- public UnexpectedCallException(final String arg0) {
- super(arg0);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.exceptions;
+
+/**
+ * Indicates that a call was made to a method (normally an overridden one) that
+ * was not expected, and hence not coded for.
+ */
+public class UnexpectedCallException extends IsisException {
+ private static final long serialVersionUID = 1L;
+
+ public UnexpectedCallException() {
+ super("This method call was not expected");
+ }
+
+ public UnexpectedCallException(final String arg0) {
+ super(arg0);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnknownTypeException.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnknownTypeException.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnknownTypeException.java
index 249b013..0dfb20d 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnknownTypeException.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/UnknownTypeException.java
@@ -1,45 +1,45 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.exceptions;
-
-public class UnknownTypeException extends IsisException {
- private static final long serialVersionUID = 1L;
-
- public UnknownTypeException() {
- super();
- }
-
- public UnknownTypeException(final String message) {
- super(message);
- }
-
- public UnknownTypeException(final Throwable cause) {
- super(cause);
- }
-
- public UnknownTypeException(final String message, final Throwable cause) {
- super(message, cause);
- }
-
- public UnknownTypeException(final Object object) {
- this(object == null ? "null" : object.toString());
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.exceptions;
+
+public class UnknownTypeException extends IsisException {
+ private static final long serialVersionUID = 1L;
+
+ public UnknownTypeException() {
+ super();
+ }
+
+ public UnknownTypeException(final String message) {
+ super(message);
+ }
+
+ public UnknownTypeException(final Throwable cause) {
+ super(cause);
+ }
+
+ public UnknownTypeException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public UnknownTypeException(final Object object) {
+ this(object == null ? "null" : object.toString());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/package-info.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/package-info.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/package-info.java
index 529181b..803004e 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/package-info.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/exceptions/package-info.java
@@ -1,25 +1,25 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Defines {@link org.apache.isis.core.commons.exceptions.IsisException base class}
- * for exceptions raised either by Isis itself or by the domain model
- * running on top of Isis.
- */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Defines {@link org.apache.isis.core.commons.exceptions.IsisException base class}
+ * for exceptions raised either by Isis itself or by the domain model
+ * running on top of Isis.
+ */
package org.apache.isis.core.commons.exceptions;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationClassException.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationClassException.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationClassException.java
index 9801d51..159091b 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationClassException.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationClassException.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.factory;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-
-public class InstanceCreationClassException extends IsisException {
- private static final long serialVersionUID = 1L;
-
- public InstanceCreationClassException() {
- super();
- }
-
- public InstanceCreationClassException(final String s) {
- super(s);
- }
-
- public InstanceCreationClassException(final Throwable cause) {
- super(cause);
- }
-
- public InstanceCreationClassException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.factory;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+
+public class InstanceCreationClassException extends IsisException {
+ private static final long serialVersionUID = 1L;
+
+ public InstanceCreationClassException() {
+ super();
+ }
+
+ public InstanceCreationClassException(final String s) {
+ super(s);
+ }
+
+ public InstanceCreationClassException(final Throwable cause) {
+ super(cause);
+ }
+
+ public InstanceCreationClassException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationException.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationException.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationException.java
index 3a7e35b..4f7d83b 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationException.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceCreationException.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.factory;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-
-public class InstanceCreationException extends IsisException {
- private static final long serialVersionUID = 1L;
-
- public InstanceCreationException() {
- super();
- }
-
- public InstanceCreationException(final String s) {
- super(s);
- }
-
- public InstanceCreationException(final Throwable cause) {
- super(cause);
- }
-
- public InstanceCreationException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.factory;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+
+public class InstanceCreationException extends IsisException {
+ private static final long serialVersionUID = 1L;
+
+ public InstanceCreationException() {
+ super();
+ }
+
+ public InstanceCreationException(final String s) {
+ super(s);
+ }
+
+ public InstanceCreationException(final Throwable cause) {
+ super(cause);
+ }
+
+ public InstanceCreationException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceUtil.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceUtil.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceUtil.java
index 4f4e9bb..54484e5 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceUtil.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/InstanceUtil.java
@@ -1,142 +1,142 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.factory;
-
-import org.apache.isis.core.commons.ensure.Assert;
-import org.apache.isis.core.commons.lang.CastUtils;
-
-public final class InstanceUtil {
-
- private InstanceUtil() {
- }
-
- public static Object createInstance(final String className) {
- return createInstance(className, (Class<?>) null, null);
- }
-
- public static Object createInstance(final Class<?> cls) {
- return createInstance(cls, (Class<?>) null, null);
- }
-
- public static <T> T createInstance(final String className, final Class<T> requiredClass) {
- return createInstance(className, (Class<T>) null, requiredClass);
- }
-
- public static <T> T createInstance(final Class<?> cls, final Class<T> requiredClass) {
- return createInstance(cls, (Class<T>) null, requiredClass);
- }
-
- public static <T> T createInstance(final String className, final String defaultTypeName, final Class<T> requiredType) {
- Class<? extends T> defaultType = null;
- if (defaultTypeName != null) {
- try {
- defaultType = CastUtils.cast(Thread.currentThread().getContextClassLoader().loadClass(defaultTypeName));
- if (defaultType == null) {
- throw new InstanceCreationClassException("Failed to load default type '" + defaultTypeName + "'");
- }
- } catch (final ClassNotFoundException e) {
- throw new UnavailableClassException("The default type '" + defaultTypeName + "' cannot be found");
- } catch (final NoClassDefFoundError e) {
- throw new InstanceCreationClassException("Default type '" + defaultTypeName + "' found, but is missing a dependent class: " + e.getMessage(), e);
- }
- }
- return createInstance(className, defaultType, requiredType);
- }
-
- public static <T> T createInstance(final Class<?> cls, final String defaultTypeName, final Class<T> requiredType) {
- Class<? extends T> defaultType = null;
- if (defaultTypeName != null) {
- defaultType = loadClass(defaultTypeName, requiredType);
- try {
- defaultType = CastUtils.cast(Thread.currentThread().getContextClassLoader().loadClass(defaultTypeName));
- if (defaultType == null) {
- throw new InstanceCreationClassException("Failed to load default type '" + defaultTypeName + "'");
- }
- } catch (final ClassNotFoundException e) {
- throw new UnavailableClassException("The default type '" + defaultTypeName + "' cannot be found");
- } catch (final NoClassDefFoundError e) {
- throw new InstanceCreationClassException("Default type '" + defaultTypeName + "' found, but is missing a dependent class: " + e.getMessage(), e);
- }
- }
- return createInstance(cls, defaultType, requiredType);
- }
-
- public static <T> T createInstance(final String className, final Class<? extends T> defaultType, final Class<T> requiredType) {
- Assert.assertNotNull("Class to instantiate must be specified", className);
- Class<?> cls = null;
- try {
- cls = Thread.currentThread().getContextClassLoader().loadClass(className);
- if (cls == null) {
- throw new InstanceCreationClassException("Failed to load class '" + className + "'");
- }
- return createInstance(cls, defaultType, requiredType);
- } catch (final ClassNotFoundException e) {
- if (className.indexOf('.') == -1) {
- throw new UnavailableClassException("The component '" + className + "' cannot be found");
- }
- throw new UnavailableClassException("The class '" + className + "' cannot be found");
- } catch (final NoClassDefFoundError e) {
- throw new InstanceCreationClassException("Class '" + className + "' found , but is missing a dependent class: " + e.getMessage(), e);
- }
- }
-
- public static <T> T createInstance(final Class<?> cls, final Class<? extends T> defaultType, final Class<T> requiredType) {
- Assert.assertNotNull("Class to instantiate must be specified", cls);
- try {
- if (requiredType == null || requiredType.isAssignableFrom(cls)) {
- final Class<T> tClass = CastUtils.cast(cls);
- return tClass.newInstance();
- } else {
- throw new InstanceCreationClassException("Class '" + cls.getName() + "' is not of type '" + requiredType + "'");
- }
- } catch (final NoClassDefFoundError e) {
- throw new InstanceCreationClassException("Class '" + cls + "'found , but is missing a dependent class: " + e.getMessage(), e);
- } catch (final InstantiationException e) {
- throw new InstanceCreationException("Could not instantiate an object of class '" + cls.getName() + "'; " + e.getMessage());
- } catch (final IllegalAccessException e) {
- throw new InstanceCreationException("Could not access the class '" + cls.getName() + "'; " + e.getMessage());
- }
- }
-
- public static Class<?> loadClass(final String className) {
- Assert.assertNotNull("Class to instantiate must be specified", className);
- try {
- return Thread.currentThread().getContextClassLoader().loadClass(className);
- } catch (final ClassNotFoundException e) {
- throw new UnavailableClassException("The default type '" + className + "' cannot be found");
- } catch (final NoClassDefFoundError e) {
- throw new InstanceCreationClassException("Default type '" + className + "' found, but is missing a dependent class: " + e.getMessage(), e);
- }
- }
-
- public static <R, T extends R> Class<T> loadClass(final String className, final Class<R> requiredType) {
- Assert.assertNotNull("Class to instantiate must be specified", className);
- try {
- final Class<?> loadedClass = loadClass(className);
- if (requiredType != null && !requiredType.isAssignableFrom(loadedClass)) {
- throw new InstanceCreationClassException("Class '" + className + "' is not of type '" + requiredType + "'");
- }
- return CastUtils.cast(loadedClass);
- } catch (final NoClassDefFoundError e) {
- throw new InstanceCreationClassException("Default type '" + className + "' found, but is missing a dependent class: " + e.getMessage(), e);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.factory;
+
+import org.apache.isis.core.commons.ensure.Assert;
+import org.apache.isis.core.commons.lang.CastUtils;
+
+public final class InstanceUtil {
+
+ private InstanceUtil() {
+ }
+
+ public static Object createInstance(final String className) {
+ return createInstance(className, (Class<?>) null, null);
+ }
+
+ public static Object createInstance(final Class<?> cls) {
+ return createInstance(cls, (Class<?>) null, null);
+ }
+
+ public static <T> T createInstance(final String className, final Class<T> requiredClass) {
+ return createInstance(className, (Class<T>) null, requiredClass);
+ }
+
+ public static <T> T createInstance(final Class<?> cls, final Class<T> requiredClass) {
+ return createInstance(cls, (Class<T>) null, requiredClass);
+ }
+
+ public static <T> T createInstance(final String className, final String defaultTypeName, final Class<T> requiredType) {
+ Class<? extends T> defaultType = null;
+ if (defaultTypeName != null) {
+ try {
+ defaultType = CastUtils.cast(Thread.currentThread().getContextClassLoader().loadClass(defaultTypeName));
+ if (defaultType == null) {
+ throw new InstanceCreationClassException("Failed to load default type '" + defaultTypeName + "'");
+ }
+ } catch (final ClassNotFoundException e) {
+ throw new UnavailableClassException("The default type '" + defaultTypeName + "' cannot be found");
+ } catch (final NoClassDefFoundError e) {
+ throw new InstanceCreationClassException("Default type '" + defaultTypeName + "' found, but is missing a dependent class: " + e.getMessage(), e);
+ }
+ }
+ return createInstance(className, defaultType, requiredType);
+ }
+
+ public static <T> T createInstance(final Class<?> cls, final String defaultTypeName, final Class<T> requiredType) {
+ Class<? extends T> defaultType = null;
+ if (defaultTypeName != null) {
+ defaultType = loadClass(defaultTypeName, requiredType);
+ try {
+ defaultType = CastUtils.cast(Thread.currentThread().getContextClassLoader().loadClass(defaultTypeName));
+ if (defaultType == null) {
+ throw new InstanceCreationClassException("Failed to load default type '" + defaultTypeName + "'");
+ }
+ } catch (final ClassNotFoundException e) {
+ throw new UnavailableClassException("The default type '" + defaultTypeName + "' cannot be found");
+ } catch (final NoClassDefFoundError e) {
+ throw new InstanceCreationClassException("Default type '" + defaultTypeName + "' found, but is missing a dependent class: " + e.getMessage(), e);
+ }
+ }
+ return createInstance(cls, defaultType, requiredType);
+ }
+
+ public static <T> T createInstance(final String className, final Class<? extends T> defaultType, final Class<T> requiredType) {
+ Assert.assertNotNull("Class to instantiate must be specified", className);
+ Class<?> cls = null;
+ try {
+ cls = Thread.currentThread().getContextClassLoader().loadClass(className);
+ if (cls == null) {
+ throw new InstanceCreationClassException("Failed to load class '" + className + "'");
+ }
+ return createInstance(cls, defaultType, requiredType);
+ } catch (final ClassNotFoundException e) {
+ if (className.indexOf('.') == -1) {
+ throw new UnavailableClassException("The component '" + className + "' cannot be found");
+ }
+ throw new UnavailableClassException("The class '" + className + "' cannot be found");
+ } catch (final NoClassDefFoundError e) {
+ throw new InstanceCreationClassException("Class '" + className + "' found , but is missing a dependent class: " + e.getMessage(), e);
+ }
+ }
+
+ public static <T> T createInstance(final Class<?> cls, final Class<? extends T> defaultType, final Class<T> requiredType) {
+ Assert.assertNotNull("Class to instantiate must be specified", cls);
+ try {
+ if (requiredType == null || requiredType.isAssignableFrom(cls)) {
+ final Class<T> tClass = CastUtils.cast(cls);
+ return tClass.newInstance();
+ } else {
+ throw new InstanceCreationClassException("Class '" + cls.getName() + "' is not of type '" + requiredType + "'");
+ }
+ } catch (final NoClassDefFoundError e) {
+ throw new InstanceCreationClassException("Class '" + cls + "'found , but is missing a dependent class: " + e.getMessage(), e);
+ } catch (final InstantiationException e) {
+ throw new InstanceCreationException("Could not instantiate an object of class '" + cls.getName() + "'; " + e.getMessage());
+ } catch (final IllegalAccessException e) {
+ throw new InstanceCreationException("Could not access the class '" + cls.getName() + "'; " + e.getMessage());
+ }
+ }
+
+ public static Class<?> loadClass(final String className) {
+ Assert.assertNotNull("Class to instantiate must be specified", className);
+ try {
+ return Thread.currentThread().getContextClassLoader().loadClass(className);
+ } catch (final ClassNotFoundException e) {
+ throw new UnavailableClassException("The default type '" + className + "' cannot be found");
+ } catch (final NoClassDefFoundError e) {
+ throw new InstanceCreationClassException("Default type '" + className + "' found, but is missing a dependent class: " + e.getMessage(), e);
+ }
+ }
+
+ public static <R, T extends R> Class<T> loadClass(final String className, final Class<R> requiredType) {
+ Assert.assertNotNull("Class to instantiate must be specified", className);
+ try {
+ final Class<?> loadedClass = loadClass(className);
+ if (requiredType != null && !requiredType.isAssignableFrom(loadedClass)) {
+ throw new InstanceCreationClassException("Class '" + className + "' is not of type '" + requiredType + "'");
+ }
+ return CastUtils.cast(loadedClass);
+ } catch (final NoClassDefFoundError e) {
+ throw new InstanceCreationClassException("Default type '" + className + "' found, but is missing a dependent class: " + e.getMessage(), e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/UnavailableClassException.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/UnavailableClassException.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/UnavailableClassException.java
index 5569f60..8362549 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/UnavailableClassException.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/UnavailableClassException.java
@@ -1,42 +1,42 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.factory;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-
-public class UnavailableClassException extends IsisException {
- private static final long serialVersionUID = 1L;
-
- public UnavailableClassException() {
- super();
- }
-
- public UnavailableClassException(final String s) {
- super(s);
- }
-
- public UnavailableClassException(final Throwable cause) {
- super(cause);
- }
-
- public UnavailableClassException(final String msg, final Throwable cause) {
- super(msg, cause);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.factory;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+
+public class UnavailableClassException extends IsisException {
+ private static final long serialVersionUID = 1L;
+
+ public UnavailableClassException() {
+ super();
+ }
+
+ public UnavailableClassException(final String s) {
+ super(s);
+ }
+
+ public UnavailableClassException(final Throwable cause) {
+ super(cause);
+ }
+
+ public UnavailableClassException(final String msg, final Throwable cause) {
+ super(msg, cause);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/package-info.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/package-info.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/package-info.java
index c23d7b6..d8377b0 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/package-info.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/factory/package-info.java
@@ -1,29 +1,29 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Provides a {@link org.apache.isis.core.commons.factory.InstanceUtil utility}
- * class for instantiating classes, ensuring that
- * they are assignable from a specified interface (if supplied).
- *
- * <p>
- * Used in various places throughout the framework, and specifically by
- * {@link org.apache.isis.core.commons.components.Installer} implementations.
- */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Provides a {@link org.apache.isis.core.commons.factory.InstanceUtil utility}
+ * class for instantiating classes, ensuring that
+ * they are assignable from a specified interface (if supplied).
+ *
+ * <p>
+ * Used in various places throughout the framework, and specifically by
+ * {@link org.apache.isis.core.commons.components.Installer} implementations.
+ */
package org.apache.isis.core.commons.factory;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/LazyInputStream.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/LazyInputStream.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/LazyInputStream.java
index 8541871..41eeba3 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/LazyInputStream.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/LazyInputStream.java
@@ -1,183 +1,183 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.io;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.isis.core.commons.ensure.Ensure;
-
-/**
- * An input stream that reads from an underlying {@link InputStream}, deferring
- * the interactions until needed.
- *
- * <p>
- * This other stream is provided as needed by an {@link InputStreamProvider} so
- * that the underlying stream is not eagerly loaded.
- */
-public class LazyInputStream extends InputStream {
-
- /**
- * An interface to be implemented by clients that wish to utilize
- * {@link LazyInputStream}s. The implementation of this interface should
- * defer obtaining the desired input stream until absolutely necessary.
- */
- public static interface InputStreamProvider {
- InputStream getInputStream() throws IOException;
- }
-
- private final InputStreamProvider provider;
-
- private InputStream underlying = null;
-
- // ///////////////////////////////////////////////////////
- // Constructor
- // ///////////////////////////////////////////////////////
-
- /**
- * Construct a new lazy stream based off the given provider.
- *
- * @param provider
- * the input stream provider. Must not be <code>null</code>.
- */
- public LazyInputStream(final InputStreamProvider provider) {
- Ensure.ensureThatArg(provider, is(not(nullValue())));
- this.provider = provider;
- }
-
- // ///////////////////////////////////////////////////////
- // InputStream API
- // ///////////////////////////////////////////////////////
-
- @Override
- public void close() throws IOException {
- obtainUnderlyingIfRequired();
- underlying.close();
- }
-
- @Override
- public int available() throws IOException {
- obtainUnderlyingIfRequired();
- return underlying.available();
- }
-
- @Override
- public void mark(final int readlimit) {
- try {
- obtainUnderlyingIfRequired();
- underlying.mark(readlimit);
- } catch (final IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public boolean markSupported() {
- try {
- obtainUnderlyingIfRequired();
- return underlying.markSupported();
- } catch (final IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public int read() throws IOException {
- obtainUnderlyingIfRequired();
- return underlying.read();
- }
-
- @Override
- public int read(final byte[] b, final int off, final int len) throws IOException {
- obtainUnderlyingIfRequired();
- return underlying.read(b, off, len);
- }
-
- @Override
- public int read(final byte[] b) throws IOException {
- obtainUnderlyingIfRequired();
- return underlying.read(b);
- }
-
- @Override
- public long skip(final long n) throws IOException {
- obtainUnderlyingIfRequired();
- return underlying.skip(n);
- }
-
- @Override
- public void reset() throws IOException {
- obtainUnderlyingIfRequired();
- underlying.reset();
- }
-
- // ///////////////////////////////////////////////////////
- // helpers
- // ///////////////////////////////////////////////////////
-
- private void obtainUnderlyingIfRequired() throws IOException {
- if (underlying == null) {
- underlying = provider.getInputStream();
- }
- }
-
- // ///////////////////////////////////////////////////////
- // equals, hashCode
- // ///////////////////////////////////////////////////////
-
- @Override
- public boolean equals(final Object obj) {
- try {
- obtainUnderlyingIfRequired();
- return underlying.equals(obj);
- } catch (final IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public int hashCode() {
- try {
- obtainUnderlyingIfRequired();
- return underlying.hashCode();
- } catch (final IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- // ///////////////////////////////////////////////////////
- // toString
- // ///////////////////////////////////////////////////////
-
- @Override
- public String toString() {
- try {
- obtainUnderlyingIfRequired();
- return underlying.toString();
- } catch (final IOException e) {
- throw new RuntimeException(e);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.io;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.isis.core.commons.ensure.Ensure;
+
+/**
+ * An input stream that reads from an underlying {@link InputStream}, deferring
+ * the interactions until needed.
+ *
+ * <p>
+ * This other stream is provided as needed by an {@link InputStreamProvider} so
+ * that the underlying stream is not eagerly loaded.
+ */
+public class LazyInputStream extends InputStream {
+
+ /**
+ * An interface to be implemented by clients that wish to utilize
+ * {@link LazyInputStream}s. The implementation of this interface should
+ * defer obtaining the desired input stream until absolutely necessary.
+ */
+ public static interface InputStreamProvider {
+ InputStream getInputStream() throws IOException;
+ }
+
+ private final InputStreamProvider provider;
+
+ private InputStream underlying = null;
+
+ // ///////////////////////////////////////////////////////
+ // Constructor
+ // ///////////////////////////////////////////////////////
+
+ /**
+ * Construct a new lazy stream based off the given provider.
+ *
+ * @param provider
+ * the input stream provider. Must not be <code>null</code>.
+ */
+ public LazyInputStream(final InputStreamProvider provider) {
+ Ensure.ensureThatArg(provider, is(not(nullValue())));
+ this.provider = provider;
+ }
+
+ // ///////////////////////////////////////////////////////
+ // InputStream API
+ // ///////////////////////////////////////////////////////
+
+ @Override
+ public void close() throws IOException {
+ obtainUnderlyingIfRequired();
+ underlying.close();
+ }
+
+ @Override
+ public int available() throws IOException {
+ obtainUnderlyingIfRequired();
+ return underlying.available();
+ }
+
+ @Override
+ public void mark(final int readlimit) {
+ try {
+ obtainUnderlyingIfRequired();
+ underlying.mark(readlimit);
+ } catch (final IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public boolean markSupported() {
+ try {
+ obtainUnderlyingIfRequired();
+ return underlying.markSupported();
+ } catch (final IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public int read() throws IOException {
+ obtainUnderlyingIfRequired();
+ return underlying.read();
+ }
+
+ @Override
+ public int read(final byte[] b, final int off, final int len) throws IOException {
+ obtainUnderlyingIfRequired();
+ return underlying.read(b, off, len);
+ }
+
+ @Override
+ public int read(final byte[] b) throws IOException {
+ obtainUnderlyingIfRequired();
+ return underlying.read(b);
+ }
+
+ @Override
+ public long skip(final long n) throws IOException {
+ obtainUnderlyingIfRequired();
+ return underlying.skip(n);
+ }
+
+ @Override
+ public void reset() throws IOException {
+ obtainUnderlyingIfRequired();
+ underlying.reset();
+ }
+
+ // ///////////////////////////////////////////////////////
+ // helpers
+ // ///////////////////////////////////////////////////////
+
+ private void obtainUnderlyingIfRequired() throws IOException {
+ if (underlying == null) {
+ underlying = provider.getInputStream();
+ }
+ }
+
+ // ///////////////////////////////////////////////////////
+ // equals, hashCode
+ // ///////////////////////////////////////////////////////
+
+ @Override
+ public boolean equals(final Object obj) {
+ try {
+ obtainUnderlyingIfRequired();
+ return underlying.equals(obj);
+ } catch (final IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ try {
+ obtainUnderlyingIfRequired();
+ return underlying.hashCode();
+ } catch (final IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // ///////////////////////////////////////////////////////
+ // toString
+ // ///////////////////////////////////////////////////////
+
+ @Override
+ public String toString() {
+ try {
+ obtainUnderlyingIfRequired();
+ return underlying.toString();
+ } catch (final IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/package-info.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/package-info.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/package-info.java
index f7488f5..823a532 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/package-info.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/io/package-info.java
@@ -1,23 +1,23 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * This package holds a small number of utilities for working with the Java i/o libraries.
- */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * This package holds a small number of utilities for working with the Java i/o libraries.
+ */
package org.apache.isis.core.commons.io;
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtil.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtil.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtil.java
index 570d48a..643419d 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtil.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtil.java
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.lang;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.apache.isis.core.commons.exceptions.IsisException;
-
-public final class ArrayUtil {
-
- private ArrayUtil() {
- }
-
- public static Object[] getObjectAsObjectArray(final Object option) {
- final Class<?> arrayType = option.getClass().getComponentType();
- if (!arrayType.isPrimitive()) {
- return (Object[]) option;
- }
- if (arrayType == char.class) {
- return ArrayUtils.convertCharToCharacterArray(option);
- } else {
- return convertPrimitiveToObjectArray(arrayType, option);
- }
- }
-
- private static Object[] convertPrimitiveToObjectArray(final Class<?> arrayType, final Object originalArray) {
- Object[] convertedArray;
- try {
- final Class<?> wrapperClass = WrapperUtils.wrap(arrayType);
- final Constructor<?> constructor = wrapperClass.getConstructor(new Class[] { String.class });
- final int len = Array.getLength(originalArray);
- convertedArray = (Object[]) Array.newInstance(wrapperClass, len);
- for (int i = 0; i < len; i++) {
- convertedArray[i] = constructor.newInstance(new Object[] { Array.get(originalArray, i).toString() });
- }
- } catch (final NoSuchMethodException e) {
- throw new IsisException(e);
- } catch (final ArrayIndexOutOfBoundsException e) {
- throw new IsisException(e);
- } catch (final IllegalArgumentException e) {
- throw new IsisException(e);
- } catch (final InstantiationException e) {
- throw new IsisException(e);
- } catch (final IllegalAccessException e) {
- throw new IsisException(e);
- } catch (final InvocationTargetException e) {
- throw new IsisException(e);
- }
- return convertedArray;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.lang;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+
+public final class ArrayUtil {
+
+ private ArrayUtil() {
+ }
+
+ public static Object[] getObjectAsObjectArray(final Object option) {
+ final Class<?> arrayType = option.getClass().getComponentType();
+ if (!arrayType.isPrimitive()) {
+ return (Object[]) option;
+ }
+ if (arrayType == char.class) {
+ return ArrayUtils.convertCharToCharacterArray(option);
+ } else {
+ return convertPrimitiveToObjectArray(arrayType, option);
+ }
+ }
+
+ private static Object[] convertPrimitiveToObjectArray(final Class<?> arrayType, final Object originalArray) {
+ Object[] convertedArray;
+ try {
+ final Class<?> wrapperClass = WrapperUtils.wrap(arrayType);
+ final Constructor<?> constructor = wrapperClass.getConstructor(new Class[] { String.class });
+ final int len = Array.getLength(originalArray);
+ convertedArray = (Object[]) Array.newInstance(wrapperClass, len);
+ for (int i = 0; i < len; i++) {
+ convertedArray[i] = constructor.newInstance(new Object[] { Array.get(originalArray, i).toString() });
+ }
+ } catch (final NoSuchMethodException e) {
+ throw new IsisException(e);
+ } catch (final ArrayIndexOutOfBoundsException e) {
+ throw new IsisException(e);
+ } catch (final IllegalArgumentException e) {
+ throw new IsisException(e);
+ } catch (final InstantiationException e) {
+ throw new IsisException(e);
+ } catch (final IllegalAccessException e) {
+ throw new IsisException(e);
+ } catch (final InvocationTargetException e) {
+ throw new IsisException(e);
+ }
+ return convertedArray;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/211aee9b/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtils.java
----------------------------------------------------------------------
diff --git a/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtils.java b/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtils.java
index ade54b0..3d6cf76 100644
--- a/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtils.java
+++ b/framework/core/commons/src/main/java/org/apache/isis/core/commons/lang/ArrayUtils.java
@@ -1,133 +1,133 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.core.commons.lang;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-public final class ArrayUtils {
-
- private ArrayUtils() {
- }
-
- public static Object[] convertCharToCharacterArray(final Object originalArray) {
- final char[] original = (char[]) originalArray;
- final int len = original.length;
- final Character[] converted = new Character[len];
- for (int i = 0; i < converted.length; i++) {
- converted[i] = Character.valueOf(original[i]);
- }
- return converted;
- }
-
- public static <T> T[] combine(final T[]... arrays) {
- final List<T> combinedList = new ArrayList<T>();
- for (final T[] array : arrays) {
- for (final T t : array) {
- combinedList.add(t);
- }
- }
- return combinedList.toArray(arrays[0]); // using 1st element of arrays
- // to specify the type
- }
-
- /**
- * Creates a mutable copy of the provided array.
- */
- public static <T> List<T> asList(final T[] items) {
- final List<T> list = new ArrayList<T>();
- for (final T item : items) {
- list.add(item);
- }
- return list;
- }
-
- /**
- * Creates a mutable copy of the provided array, eliminating duplicates.
- *
- * <p>
- * The order of the items will be preserved.
- */
- public static <T> Set<T> asOrderedSet(final T[] items) {
- final LinkedHashSet<T> list = new LinkedHashSet<T>();
- if (items != null) {
- for (final T item : items) {
- list.add(item);
- }
- }
- return list;
- }
-
- /**
- * Creates a mutable list of the provided array, also appending the
- * additional element(s).
- */
- public static <T> List<T> concat(final T[] elements, final T... elementsToAppend) {
- final List<T> result = new ArrayList<T>();
- for (final T element : elements) {
- result.add(element);
- }
- for (final T element : elementsToAppend) {
- if (element != null) {
- result.add(element);
- }
- }
- return result;
- }
-
- public static String[] append(final String[] args, final String... moreArgs) {
- final ArrayList<String> argList = new ArrayList<String>();
- argList.addAll(Arrays.asList(args));
- argList.addAll(Arrays.asList(moreArgs));
- return argList.toArray(new String[] {});
- }
-
- /**
- * Creates a mutable list of the provided array, also appending the
- * additional element(s).
- */
- public static <T> List<T> concat(final T[] elements, final List<T> elementsToAppend) {
- final List<T> result = new ArrayList<T>();
- for (final T element : elements) {
- result.add(element);
- }
- for (final T element : elementsToAppend) {
- if (element != null) {
- result.add(element);
- }
- }
- return result;
- }
-
- @SuppressWarnings("unchecked")
- public static <D, S> D[] copy(final S[] source, final Class<D> cls) {
- if (source == null) {
- throw new IllegalArgumentException("Source array cannot be null");
- }
- final D[] destination = (D[]) Array.newInstance(cls, source.length);
- System.arraycopy(source, 0, destination, 0, source.length);
- return destination;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.commons.lang;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+public final class ArrayUtils {
+
+ private ArrayUtils() {
+ }
+
+ public static Object[] convertCharToCharacterArray(final Object originalArray) {
+ final char[] original = (char[]) originalArray;
+ final int len = original.length;
+ final Character[] converted = new Character[len];
+ for (int i = 0; i < converted.length; i++) {
+ converted[i] = Character.valueOf(original[i]);
+ }
+ return converted;
+ }
+
+ public static <T> T[] combine(final T[]... arrays) {
+ final List<T> combinedList = new ArrayList<T>();
+ for (final T[] array : arrays) {
+ for (final T t : array) {
+ combinedList.add(t);
+ }
+ }
+ return combinedList.toArray(arrays[0]); // using 1st element of arrays
+ // to specify the type
+ }
+
+ /**
+ * Creates a mutable copy of the provided array.
+ */
+ public static <T> List<T> asList(final T[] items) {
+ final List<T> list = new ArrayList<T>();
+ for (final T item : items) {
+ list.add(item);
+ }
+ return list;
+ }
+
+ /**
+ * Creates a mutable copy of the provided array, eliminating duplicates.
+ *
+ * <p>
+ * The order of the items will be preserved.
+ */
+ public static <T> Set<T> asOrderedSet(final T[] items) {
+ final LinkedHashSet<T> list = new LinkedHashSet<T>();
+ if (items != null) {
+ for (final T item : items) {
+ list.add(item);
+ }
+ }
+ return list;
+ }
+
+ /**
+ * Creates a mutable list of the provided array, also appending the
+ * additional element(s).
+ */
+ public static <T> List<T> concat(final T[] elements, final T... elementsToAppend) {
+ final List<T> result = new ArrayList<T>();
+ for (final T element : elements) {
+ result.add(element);
+ }
+ for (final T element : elementsToAppend) {
+ if (element != null) {
+ result.add(element);
+ }
+ }
+ return result;
+ }
+
+ public static String[] append(final String[] args, final String... moreArgs) {
+ final ArrayList<String> argList = new ArrayList<String>();
+ argList.addAll(Arrays.asList(args));
+ argList.addAll(Arrays.asList(moreArgs));
+ return argList.toArray(new String[] {});
+ }
+
+ /**
+ * Creates a mutable list of the provided array, also appending the
+ * additional element(s).
+ */
+ public static <T> List<T> concat(final T[] elements, final List<T> elementsToAppend) {
+ final List<T> result = new ArrayList<T>();
+ for (final T element : elements) {
+ result.add(element);
+ }
+ for (final T element : elementsToAppend) {
+ if (element != null) {
+ result.add(element);
+ }
+ }
+ return result;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <D, S> D[] copy(final S[] source, final Class<D> cls) {
+ if (source == null) {
+ throw new IllegalArgumentException("Source array cannot be null");
+ }
+ final D[] destination = (D[]) Array.newInstance(cls, source.length);
+ System.arraycopy(source, 0, destination, 0, source.length);
+ return destination;
+ }
+
+}