@@ -48,7 +48,7 @@ private Builders() {
4848 }
4949
5050 /** All known {@link BuilderFactory} implementations, in priority order. */
51- private static final List <BuilderFactory > ALL = Plugins .discover (BuilderFactory .class ,
51+ private static final List <BuilderFactory > BUILDERS = Plugins .discover (BuilderFactory .class ,
5252 (a , b ) -> Double .compare (b .priority (), a .priority ()));
5353
5454 /**
@@ -58,7 +58,7 @@ private Builders() {
5858 * @return The factory with matching name, or null if not found.
5959 */
6060 public static @ Nullable BuilderFactory findFactoryByName (String name ) {
61- return Plugins .find (ALL , factory -> factory .name ().equalsIgnoreCase (name ));
61+ return Plugins .find (BUILDERS , factory -> factory .name ().equalsIgnoreCase (name ));
6262 }
6363
6464 /**
@@ -69,7 +69,18 @@ private Builders() {
6969 * @return The first factory that supports the scheme, or null if none found.
7070 */
7171 public static @ Nullable BuilderFactory findFactoryByScheme (String scheme ) {
72- return Plugins .find (ALL , factory -> factory .supportsScheme (scheme ));
72+ return Plugins .find (BUILDERS , factory -> factory .supportsScheme (scheme ));
73+ }
74+
75+ /**
76+ * Finds the first factory that can wrap the given environment directory.
77+ * Factories are checked in priority order (highest priority first).
78+ *
79+ * @param envDir The directory to find a factory for.
80+ * @return The first factory that can wrap the directory, or null if none found.
81+ */
82+ public static @ Nullable BuilderFactory findFactoryForWrapping (String envDir ) {
83+ return findFactoryForWrapping (new File (envDir ));
7384 }
7485
7586 /**
@@ -80,7 +91,18 @@ private Builders() {
8091 * @return The first factory that can wrap the directory, or null if none found.
8192 */
8293 public static @ Nullable BuilderFactory findFactoryForWrapping (File envDir ) {
83- return Plugins .find (ALL , factory -> factory .canWrap (envDir ));
94+ return Plugins .find (BUILDERS , factory -> factory .canWrap (envDir ));
95+ }
96+
97+ /**
98+ * Checks if the given directory can be wrapped as a known environment type.
99+ * This is a convenience method equivalent to {@code findFactoryForWrapping(envDir) != null}.
100+ *
101+ * @param envDir The directory to check.
102+ * @return true if the directory can be wrapped by any known builder, false otherwise.
103+ */
104+ public static boolean canWrap (String envDir ) {
105+ return canWrap (new File (envDir ));
84106 }
85107
86108 /**
0 commit comments