View Javadoc

1   package com.lexicalscope.fluentreflection;
2   
3   import static ch.lambdaj.Lambda.join;
4   
5   import java.lang.reflect.Field;
6   import java.lang.reflect.Member;
7   
8   public class IllegalArgumentRuntimeException extends ReflectionRuntimeException {
9       private static final long serialVersionUID = -2532532215028572886L;
10  
11      public IllegalArgumentRuntimeException() {
12          super();
13      }
14  
15      public IllegalArgumentRuntimeException(final String message, final Throwable cause) {
16          super(message, cause);
17      }
18  
19      public IllegalArgumentRuntimeException(final String message) {
20          super(message);
21      }
22  
23      public IllegalArgumentRuntimeException(final Throwable cause) {
24          super(cause);
25      }
26  
27      public IllegalArgumentRuntimeException(
28              final IllegalArgumentException e,
29              final Member member,
30              final Object instance,
31              final Object[] arguments) {
32          this(String.format(
33                  "when calling %s on %s with %s : %s",
34                  member,
35                  instance,
36                  join(arguments, ", "),
37                  e.getMessage()), e);
38      }
39  
40      public IllegalArgumentRuntimeException(final IllegalArgumentException e, final Field field, final Object instance) {
41          this(String.format(
42                  "when reading %s on %s : %s",
43                  field,
44                  instance,
45                  e.getMessage()), e);
46      }
47  }