/** tries to create a Dir from the given url, using the given urlTypes*/ public static Dir fromURL(final URL url, final List<UrlType> urlTypes) { for (UrlType type : urlTypes) { try { if (type.matches(url)) { Dir dir = type.createDir(url); if (dir != null) return dir; } } catch (Throwable e) { if (Reflections.log != null) { Reflections.log.warn("could not create Dir using " + type + " from url " + url.toExternalForm() + ". skipping.", e); } } } throw new ReflectionsException("could not create Vfs.Dir from url, no matching UrlType was found [" + url.toExternalForm() + "]\n" + "either use fromURL(final URL url, final List<UrlType> urlTypes) or " + "use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) " + "with your specialized UrlType."); }
/** tries to create a Dir from the given url, using the given urlTypes*/ public static Dir fromURL(final URL url, final List<UrlType> urlTypes) { for (UrlType type : urlTypes) { try { if (type.matches(url)) { Dir dir = type.createDir(url); if (dir != null) return dir; } } catch (Throwable e) { if (Reflections.log != null) { Reflections.log.warn("could not create Dir using " + type + " from url " + url.toExternalForm() + ". skipping.", e); } } } throw new ReflectionsException("could not create Vfs.Dir from url, no matching UrlType was found [" + url.toExternalForm() + "]\n" + "either use fromURL(final URL url, final List<UrlType> urlTypes) or " + "use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) " + "with your specialized UrlType."); }
/** tries to create a Dir from the given url, using the given urlTypes*/ public static Dir fromURL(final URL url, final List<UrlType> urlTypes) { for (UrlType type : urlTypes) { try { if (type.matches(url)) { Dir dir = type.createDir(url); if (dir != null) return dir; } } catch (Throwable e) { if (Reflections.log != null) { Reflections.log.warn("could not create Dir using " + type + " from url " + url.toExternalForm() + ". skipping.", e); } } } throw new ReflectionsException("could not create Vfs.Dir from url, no matching UrlType was found [" + url.toExternalForm() + "]\n" + "either use fromURL(final URL url, final List<UrlType> urlTypes) or " + "use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) " + "with your specialized UrlType."); }
public static Dir fromURL(final URL url , final List<UrlType> urlTypes) { for (UrlType type : urlTypes) { try { if (type.matches(url)) { Dir dir = type.createDir(url); if (dir != null) return dir; } } catch (Throwable e) { final LoggingService log = Logger.getLogger(Reflections.class); if (log != null) { log.warning("could not create Dir using " + type + " from url " + url.toExternalForm() + ". skipping." , e); } } } throw new ReflectionsException("could not create Vfs.Dir from url, no matching UrlType was found [" + url.toExternalForm() + "]\n" + "either use fromURL(final URL url, final List<UrlType> urlTypes) or " + "use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) " + "with your specialized UrlType."); }
/** a matcher and factory for a url */ public interface UrlType { boolean matches(URL url) throws Exception; Dir createDir(URL url) throws Exception; }
/** tries to create a Dir from the given url, using the given urlTypes*/ public static Dir fromURL(final URL url, final List<UrlType> urlTypes) { for (UrlType type : urlTypes) { try { if (type.matches(url)) { Dir dir = type.createDir(url); if (dir != null) return dir; } } catch (Throwable e) { if (Reflections.log != null) { Reflections.log.warn("could not create Dir using " + type + " from url " + url.toExternalForm() + ". skipping.", e); } } } throw new ReflectionsException("could not create Vfs.Dir from url, no matching UrlType was found [" + url.toExternalForm() + "]\n" + "either use fromURL(final URL url, final List<UrlType> urlTypes) or " + "use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) " + "with your specialized UrlType."); }