Class DefaultDependencyResolver

  • All Implemented Interfaces:
    DependencyResolver

    public final class DefaultDependencyResolver
    extends java.lang.Object
    implements DependencyResolver
    Class for resolving Closure dependencies. Given a valid deps.js file the dependency tree is parsed and stored in memory. The DependencyResolver can then be used to calculate the full list of transitive dependencies from: a block of code ( getDependencies(String)), or a list of symbols getDependencies(Collection).
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.String> getDependencies​(java.lang.String code)
      Gets a list of dependencies for the provided code.
      java.util.List<java.lang.String> getDependencies​(java.lang.String code, java.util.Set<java.lang.String> seen, boolean addClosureBaseFile)  
      java.util.List<java.lang.String> getDependencies​(java.util.Collection<java.lang.String> symbols)
      Gets a list of dependencies for the provided list of symbols.
      java.util.List<java.lang.String> getDependencies​(java.util.Collection<java.lang.String> symbols, java.util.Set<java.lang.String> seen)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultDependencyResolver

        public DefaultDependencyResolver​(java.util.List<DependencyFile> depsFiles,
                                         boolean strictRequires)
        Creates a new dependency resolver.
        Parameters:
        depsFiles - List of deps file.
        strictRequires - Determines if the resolver will through an exception on a missing dependency.
    • Method Detail

      • getDependencies

        public java.util.List<java.lang.String> getDependencies​(java.lang.String code,
                                                                java.util.Set<java.lang.String> seen,
                                                                boolean addClosureBaseFile)
                                                         throws ServiceException
        Specified by:
        getDependencies in interface DependencyResolver
        Parameters:
        code - The raw code to be parsed for requires.
        seen - The set of already seen symbols.
        addClosureBaseFile - Indicates whether the closure base file should be added to the dependency list.
        Returns:
        A list of filenames for each of the dependencies for the provided code.
        Throws:
        ServiceException
      • getDependencies

        public java.util.List<java.lang.String> getDependencies​(java.util.Collection<java.lang.String> symbols,
                                                                java.util.Set<java.lang.String> seen)
                                                         throws ServiceException
        Specified by:
        getDependencies in interface DependencyResolver
        Parameters:
        symbols - A list of required symbols.
        seen - The set of already seen symbols.
        Returns:
        A list of filenames for each of the required symbols.
        Throws:
        ServiceException