@@ -51,27 +51,30 @@ protected ClasspathBuilder(List<URL> urls) {
51
51
}
52
52
53
53
/**
54
- * Builds a classpath string or an argument file representing the classpath, depending
55
- * on the operating system.
56
- * @param urls an array of {@link URL} representing the elements of the classpath
57
- * @return the classpath; on Windows, the path to an argument file is returned,
58
- * prefixed with '@'
54
+ * Creates a ClasspathBuilder instance using the specified list of URLs.
55
+ * @param urls a list of {@link URL} objects representing the elements of the
56
+ * classpath
57
+ * @return a new instance of {@code ClasspathBuilder}
59
58
*/
60
59
static ClasspathBuilder forURLs (List <URL > urls ) {
61
60
return new ClasspathBuilder (new ArrayList <>(urls ));
62
61
}
63
62
64
63
/**
65
- * Builds a classpath string or an argument file representing the classpath, depending
66
- * on the operating system.
67
- * @param urls an array of {@link URL} representing the elements of the classpath
68
- * @return the classpath; on Windows, the path to an argument file is returned,
69
- * prefixed with '@'
64
+ * Creates a ClasspathBuilder instance using the specified array of URLs.
65
+ * @param urls an array of {@link URL} objects representing the elements of the
66
+ * classpath
67
+ * @return a new instance of {@code ClasspathBuilder}
70
68
*/
71
69
static ClasspathBuilder forURLs (URL ... urls ) {
72
70
return new ClasspathBuilder (Arrays .asList (urls ));
73
71
}
74
72
73
+ /**
74
+ * Builds {@link Classpath} that containing a classpath argument and its corresponding
75
+ * classpath elements.
76
+ * @return a {@code Classpath}
77
+ */
75
78
Classpath build () {
76
79
if (ObjectUtils .isEmpty (this .urls )) {
77
80
return new Classpath ("" , Collections .emptyList ());
@@ -88,6 +91,13 @@ Classpath build() {
88
91
return new Classpath (argument , files );
89
92
}
90
93
94
+ /**
95
+ * Determines if an argument file should be used for the classpath based on the
96
+ * operating system. On Windows, argument files are used due to the command length
97
+ * limitation.
98
+ * @return {@code true} if an argument file is required for the classpath,
99
+ * {@code false} otherwise
100
+ */
91
101
protected boolean needsClasspathArgFile () {
92
102
String os = System .getProperty ("os.name" );
93
103
if (!StringUtils .hasText (os )) {
@@ -145,6 +155,9 @@ private static Path toFile(URL url) {
145
155
}
146
156
}
147
157
158
+ /**
159
+ * Classpath consisting of a {@code -cp} argument and its associated elements.
160
+ */
148
161
static final class Classpath {
149
162
150
163
private final String argument ;
@@ -157,7 +170,8 @@ private Classpath(String argument, List<Path> elements) {
157
170
}
158
171
159
172
/**
160
- * Return the {@code -cp} argument value.
173
+ * Return the {@code -cp} argument value; on Windows, the path to an argument file
174
+ * is returned, prefixed with '@'.
161
175
* @return the argument to use
162
176
*/
163
177
String argument () {
0 commit comments