| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.fest.swing.launcher; |
| 17 |
|
|
| 18 |
|
import static org.fest.reflect.core.Reflection.staticMethod; |
| 19 |
|
import static org.fest.swing.util.Arrays.copyOf; |
| 20 |
|
import static org.fest.util.Strings.concat; |
| 21 |
|
import static org.fest.util.Strings.quote; |
| 22 |
|
|
| 23 |
|
import org.fest.reflect.exception.ReflectionError; |
| 24 |
|
import org.fest.swing.exception.UnexpectedException; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
|
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
@link@link |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
|
| 44 |
|
@link@link@link |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
@link@link@link |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
@author |
| 54 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 7 |
Complexity Density: 0.64 |
|
| 55 |
|
public class ApplicationLauncher { |
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
@param |
| 60 |
|
@return |
| 61 |
|
@throws |
| 62 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 63 |
2
|
public static ApplicationLauncher application(String applicationTypeName) {... |
| 64 |
2
|
try { |
| 65 |
2
|
Class<?> applicationType = Thread.currentThread().getContextClassLoader().loadClass(applicationTypeName); |
| 66 |
1
|
return application(applicationType); |
| 67 |
|
} catch (ClassNotFoundException e) { |
| 68 |
1
|
throw new UnexpectedException(concat("Unable to load class ", quote(applicationTypeName)), e); |
| 69 |
|
} |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
@param |
| 75 |
|
@return |
| 76 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 77 |
4
|
public static ApplicationLauncher application(Class<?> applicationType) {... |
| 78 |
4
|
return new ApplicationLauncher(applicationType); |
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
private final Class<?> applicationType; |
| 82 |
|
private String[] args = new String[0]; |
| 83 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 84 |
4
|
private ApplicationLauncher(Class<?> applicationType) {... |
| 85 |
4
|
this.applicationType = applicationType; |
| 86 |
|
} |
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
|
| 91 |
|
@param |
| 92 |
|
@return |
| 93 |
|
@throws |
| 94 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 95 |
2
|
public ApplicationLauncher withArgs(String...newArgs) {... |
| 96 |
1
|
if (newArgs == null) throw new NullPointerException("The array of arguments should not be null"); |
| 97 |
1
|
args = copyOf(newArgs); |
| 98 |
1
|
return this; |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
@throws |
| 104 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 105 |
3
|
public void start() {... |
| 106 |
3
|
staticMethod("main").withParameterTypes(String[].class).in(applicationType).invoke(new Object[] { args }); |
| 107 |
|
} |
| 108 |
|
} |