Class JamServiceContextImpl

    • Constructor Detail

      • JamServiceContextImpl

        public JamServiceContextImpl()
    • Method Detail

      • setClassLoader

        public void setClassLoader​(JamClassLoader loader)
      • getTagParser

        public JavadocTagParser getTagParser()
        Description copied from interface: JamServiceContext

        Returns the JavadocTagParser to be used in processing javadoc tags. This never returns null - if no parser was specified by the user, the default one is used. This method should be used only by JavadocClassBuilder.

        Specified by:
        getTagParser in interface JamServiceContext
      • getAllClassnames

        public java.lang.String[] getAllClassnames()
                                            throws java.io.IOException
        Returns an array containing the qualified names of the classes which are in the Service class set.
        Specified by:
        getAllClassnames in interface JamServiceContext
        Throws:
        java.io.IOException
      • getSourceFiles

        public java.io.File[] getSourceFiles()
                                      throws java.io.IOException
        Specified by:
        getSourceFiles in interface JamServiceContext
        Throws:
        java.io.IOException
      • getUnstructuredSourceFiles

        public java.io.File[] getUnstructuredSourceFiles()
      • getInputClasspath

        public ResourcePath getInputClasspath()
        Specified by:
        getInputClasspath in interface JamServiceContext
        Returns:
        The classpath to be searched when trying to initialize an MClass for a java class which was not in the inputSources or inputClasses, or null.
      • getInputSourcepath

        public ResourcePath getInputSourcepath()
        Specified by:
        getInputSourcepath in interface JamServiceContext
        Returns:
        The sourcepath to be searched when trying to initialize an MClass for a java class which was not in the inputSources or inputClasses, or null.
      • getToolClasspath

        public ResourcePath getToolClasspath()
        Specified by:
        getToolClasspath in interface JamServiceContext
        Returns:
        The classpath to be used in loading external classes on which the service implementation depends, or null. This is not generally needed.
      • getProperty

        public java.lang.String getProperty​(java.lang.String name)
        Specified by:
        getProperty in interface JamServiceContext
        Returns:
        an implementation-specific property, as specified by JamServiceParams.setProperty().
      • addClassBuilder

        public void addClassBuilder​(JamClassBuilder builder)
        Description copied from interface: JamServiceParams

        Adds a custom JamClassBuilder which will be consulted by the JamClassLoader when constructing representation of java types. The given class builder will have priority over priority over JAM's default source- and reflection-based ClassBuilders. If this method id called more than once, the extra class builders will be prioritized in the order in which they were added.

        Specified by:
        addClassBuilder in interface JamServiceParams
      • setCommentInitializer

        public void setCommentInitializer​(MVisitor initializer)
      • includeSourceFile

        public void includeSourceFile​(java.io.File file)
        Description copied from interface: JamServiceParams

        Include a single java source file to be viewed. Note that if your code is able to understand the file/package structure in which the source exists, you may get better performance by using the various include... methods which take a sourcepath parameter.

        Specified by:
        includeSourceFile in interface JamServiceParams
      • includeSourcePattern

        public void includeSourcePattern​(java.io.File[] sourcepath,
                                         java.lang.String pattern)
        Description copied from interface: JamServiceParams
        Specifies a set of java source files to be included in the JamService.

        Note that calling this method implicitly includes the 'root' in the sourcepath (exactly as if addSourcepath(root) had been called).

        Specified by:
        includeSourcePattern in interface JamServiceParams
        Parameters:
        sourcepath - Root directory/ies containing source files.
        pattern - A relative file pattern (as described above under 'Include and Exclude Patterns').
      • includeClassPattern

        public void includeClassPattern​(java.io.File[] classpath,
                                        java.lang.String pattern)
        Description copied from interface: JamServiceParams
        Specifies a set of java class files to be excluded in the JamService. Note that calling this method implicitly includes the 'classpath' in the classpath (as in a call to addClasspath(classpath)).
        Specified by:
        includeClassPattern in interface JamServiceParams
        Parameters:
        classpath - Root directory of the source files.
        pattern - A relative file pattern (as described above under 'Include and Exclude Patterns').
      • excludeSourcePattern

        public void excludeSourcePattern​(java.io.File[] sourcepath,
                                         java.lang.String pattern)
        Description copied from interface: JamServiceParams
        Specifies a set of java source files to be excluded in the JamService. Note that calling this method implicitly includes the 'sourcepath' in the sourcepath (as in a call to addSourcepath(sourcepath)).
        Specified by:
        excludeSourcePattern in interface JamServiceParams
        Parameters:
        sourcepath - Root directory of the source files.
        pattern - A relative file pattern (as described above under 'Include and Exclude Patterns').
      • excludeClassPattern

        public void excludeClassPattern​(java.io.File[] classpath,
                                        java.lang.String pattern)
        Description copied from interface: JamServiceParams
        Specifies a set of java class files to be excluded from the JamService. Note that calling this method implicitly includes the 'classpath' in the classpath (as in a call to addClasspath(classpath)).
        Specified by:
        excludeClassPattern in interface JamServiceParams
        Parameters:
        classpath - Root directory of the source files.
        pattern - A relative file pattern (as described above under 'Include and Exclude Patterns').
      • includeSourceFile

        public void includeSourceFile​(java.io.File[] sourcepath,
                                      java.io.File sourceFile)
        Description copied from interface: JamServiceParams

        Includes a single source File in the JamService. The sourcepath parameter should identify the source sourcepath of the java source file; the sourceFile parameter must be under the sourcepath subtree.

        For example, if a class "foo.bar.MyClass" is stored in a file "c:/myproject/src/foo/bar/MyClass.java", that class could be included in the service by calling

          includeSourceFile(new File("c:/myproject/src"),
                            new File("c:/myproject/src/foo/bar/MyClass.java"));
         

        Note that this equivalent to calling

          includeSourceFiles(new File("c:/myproject/src"),"foo/bar/MyClass.java");
         

        If you are calling this method and have more than one sourcepath directory, and do not readily know which is the correct sourcepath for a given source File, you can use the getRootForFile() utility method to determine the correct sourcepath to use.

        Note that calling this method implicitly includes the 'sourcepath' in the sourcepath (exactly as if addSourcepath(sourcepath) had been called).

        Specified by:
        includeSourceFile in interface JamServiceParams
        Parameters:
        sourcepath - source sourcepath for the java source file
        sourceFile - the java source file
      • excludeSourceFile

        public void excludeSourceFile​(java.io.File[] sourcepath,
                                      java.io.File sourceFile)
        Description copied from interface: JamServiceParams

        Excludes a single source File in the JamService in exactly the same way theat includeSourceFile() includes a source file.

        Specified by:
        excludeSourceFile in interface JamServiceParams
      • includeClassFile

        public void includeClassFile​(java.io.File[] classpath,
                                     java.io.File classFile)
        Description copied from interface: JamServiceParams

        Includes a single class File in the JamService in exactly the same way theat includeSourceFile() includes a source file.

        Specified by:
        includeClassFile in interface JamServiceParams
      • excludeClassFile

        public void excludeClassFile​(java.io.File[] classpath,
                                     java.io.File classFile)
        Description copied from interface: JamServiceParams

        Excludes a single class File in the JamService in exactly the same way theat includeSourceFile() includes a source file.

        Specified by:
        excludeClassFile in interface JamServiceParams
      • includeClass

        public void includeClass​(java.lang.String qualifiedClassname)
        Description copied from interface: JamServiceParams
        Names a specific class to be included in the JamService. Note that this will return an 'unresolved' JClass unless a source or class file for the named class is available in the classpath or sourcepath.
        Specified by:
        includeClass in interface JamServiceParams
        Parameters:
        qualifiedClassname - a full-qualified classname
      • excludeClass

        public void excludeClass​(java.lang.String qualifiedClassname)
        Description copied from interface: JamServiceParams
        Names a specific class to be excluded in the JamService. Note that this will have no affect if the named class cannot be found in the sourcepath or classpath.
        Specified by:
        excludeClass in interface JamServiceParams
        Parameters:
        qualifiedClassname - a full-qualified classname
      • addClasspath

        public void addClasspath​(java.io.File classpathElement)
        Description copied from interface: JamServiceParams
        Adds an elements to the JamService classpath. The service's JamClassLoader will search this path to find a .class file on which to base a JClass when requested to load a class that was not included in the service and for which no source could be found in the sourcepath.
        Specified by:
        addClasspath in interface JamServiceParams
        Parameters:
        classpathElement - elements of the classpath
      • setLoggerWriter

        public void setLoggerWriter​(java.io.PrintWriter out)
        Description copied from interface: JamServiceParams
        Sets a PrintWriter to which the JamService implementation should log errors and debugging information. If this is never set, all such output will be suppressed.
        Specified by:
        setLoggerWriter in interface JamServiceParams
        Parameters:
        out - a PrintWriter to write to
      • addSourcepath

        public void addSourcepath​(java.io.File sourcepathElement)
        Description copied from interface: JamServiceParams
        Adds an elements to the JamService sourcepath. The service's JamClassLoader will search this path to find a .java file on which to base a JClass when requested to load a class that was not included in the service.
        Specified by:
        addSourcepath in interface JamServiceParams
      • addToolClasspath

        public void addToolClasspath​(java.io.File classpathElement)
        Description copied from interface: JamServiceParams

        Adds an elements to the tool classpath. This is the classpath that will be used by the JamService implementation to find any libraries on which it depends. This classpath is distinct from the service classpath set by addClasspath() in that it has no affect on the input class set - it's only used for finding classes on which JAM itself depends.

        Specified by:
        addToolClasspath in interface JamServiceParams
        Parameters:
        classpathElement - elements of the classpath
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.String value)
        Description copied from interface: JamServiceParams

        Sets an implementation-specific property.

        Specified by:
        setProperty in interface JamServiceParams
      • set14WarningsEnabled

        public void set14WarningsEnabled​(boolean b)
        Description copied from interface: JamServiceParams

        Sets whether warnings should be displayed when running under JDK 1.4. The default is true.

        Specified by:
        set14WarningsEnabled in interface JamServiceParams
      • setUseSystemClasspath

        public void setUseSystemClasspath​(boolean use)
        Description copied from interface: JamServiceParams

        Specifies whether the JAM Service should load classes from the system classpath. The default for this is true, and you shouldn't set it to false unless you really know what you are doing.

        Specified by:
        setUseSystemClasspath in interface JamServiceParams