public class JamServiceContextImpl extends JamLoggerImpl implements JamServiceContext, JamServiceParams, ElementContext
Takes settings from the user (through JamServiceParams) and exposes them to the implementation (through JamServiceContext).
| Constructor and Description |
|---|
JamServiceContextImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addClassBuilder(JamClassBuilder builder)
Adds a custom JamClassBuilder which will be consulted by the
JamClassLoader when constructing representation of java types.
|
void |
addClassLoader(ClassLoader cl)
DOCME
|
void |
addClasspath(File classpathElement)
Adds an elements to the JamService classpath.
|
void |
addInitializer(MVisitor initializer) |
void |
addSourcepath(File sourcepathElement)
Adds an elements to the JamService sourcepath.
|
void |
addToolClasspath(File classpathElement)
Adds an elements to the tool classpath.
|
AnnotationProxy |
createAnnotationProxy(String jsr175typename)
Creates an empty appropriate proxy for the given 175 annotation
instance.
|
void |
excludeClass(String qualifiedClassname)
Names a specific class to be excluded in the JamService.
|
void |
excludeClassFile(File[] classpath,
File classFile)
Excludes a single class File in the JamService in exactly the same
way theat includeSourceFile() includes a source file.
|
void |
excludeClassPattern(File[] classpath,
String pattern)
Specifies a set of java class files to be excluded from the JamService.
|
void |
excludeSourceFile(File[] sourcepath,
File sourceFile)
Excludes a single source File in the JamService in exactly the same
way theat includeSourceFile() includes a source file.
|
void |
excludeSourcePattern(File[] sourcepath,
String pattern)
Specifies a set of java source files to be excluded in the JamService.
|
String[] |
getAllClassnames()
Returns an array containing the qualified names of the classes which
are in the Service class set.
|
JamClassBuilder |
getBaseBuilder() |
JamClassLoader |
getClassLoader()
Returns the classloader the elements should use for type resolution.
|
MVisitor |
getInitializer() |
ResourcePath |
getInputClasspath() |
ResourcePath |
getInputSourcepath() |
JamLogger |
getLogger() |
String |
getProperty(String name) |
ClassLoader[] |
getReflectionClassLoaders() |
File[] |
getSourceFiles() |
JavadocTagParser |
getTagParser()
Returns the JavadocTagParser to be used in processing javadoc tags.
|
ResourcePath |
getToolClasspath() |
File[] |
getUnstructuredSourceFiles() |
void |
includeClass(String qualifiedClassname)
Names a specific class to be included in the JamService.
|
void |
includeClassFile(File[] classpath,
File classFile)
Includes a single class File in the JamService in exactly the same
way theat includeSourceFile() includes a source file.
|
void |
includeClassPattern(File[] classpath,
String pattern)
Specifies a set of java class files to be excluded in the JamService.
|
void |
includeSourceFile(File file)
Include a single java source file to be viewed.
|
void |
includeSourceFile(File[] sourcepath,
File sourceFile)
Includes a single source File in the JamService.
|
void |
includeSourcePattern(File[] sourcepath,
String pattern)
Specifies a set of java source files to be included in the JamService.
|
boolean |
is14WarningsEnabled() |
void |
set14WarningsEnabled(boolean b)
Sets whether warnings should be displayed when running under
JDK 1.4.
|
void |
setClassLoader(JamClassLoader loader) |
void |
setCommentInitializer(MVisitor initializer) |
void |
setJamLogger(JamLogger logger)
Sets the JamLogger which will receive error and warning messages from
JAM.
|
void |
setJavadocTagParser(JavadocTagParser tp) |
void |
setLoggerWriter(PrintWriter out)
Sets a PrintWriter to which the JamService implementation should log
errors and debugging information.
|
void |
setParentClassLoader(JamClassLoader loader)
Sets the parent JamClassLoader of the service JamClassLoader.
|
void |
setProperty(String name,
String value)
Sets an implementation-specific property.
|
void |
setPropertyInitializer(MVisitor initializer) |
void |
setUseSystemClasspath(boolean use)
Specifies whether the JAM Service should load classes from the system
classpath.
|
error, error, isVerbose, isVerbose, isVerbose, setShowWarnings, setVerbose, setVerbose, verbose, verbose, verbose, verbose, warning, warningequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetShowWarnings, setVerbose, setVerbosepublic void setClassLoader(JamClassLoader loader)
public JamClassBuilder getBaseBuilder()
getBaseBuilder in interface JamServiceContextpublic JavadocTagParser getTagParser()
JamServiceContextReturns 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.
getTagParser in interface JamServiceContextpublic String[] getAllClassnames() throws IOException
getAllClassnames in interface JamServiceContextIOExceptionpublic JamLogger getLogger()
getLogger in interface ElementContextgetLogger in interface JamServiceContextpublic File[] getSourceFiles() throws IOException
getSourceFiles in interface JamServiceContextIOExceptionpublic File[] getUnstructuredSourceFiles()
public ResourcePath getInputClasspath()
getInputClasspath in interface JamServiceContextpublic ResourcePath getInputSourcepath()
getInputSourcepath in interface JamServiceContextpublic ResourcePath getToolClasspath()
getToolClasspath in interface JamServiceContextpublic String getProperty(String name)
getProperty in interface JamServiceContextJamServiceParams.setProperty().public MVisitor getInitializer()
getInitializer in interface JamServiceContextpublic void addClassBuilder(JamClassBuilder builder)
JamServiceParamsAdds 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.
addClassBuilder in interface JamServiceParamspublic void setCommentInitializer(MVisitor initializer)
public void setPropertyInitializer(MVisitor initializer)
setPropertyInitializer in interface JamServiceParamspublic void addInitializer(MVisitor initializer)
addInitializer in interface JamServiceParamspublic void setJavadocTagParser(JavadocTagParser tp)
setJavadocTagParser in interface JamServiceParamspublic void includeSourceFile(File file)
JamServiceParamsInclude 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.
includeSourceFile in interface JamServiceParamspublic void includeSourcePattern(File[] sourcepath, String pattern)
JamServiceParamsNote that calling this method implicitly includes the 'root' in the sourcepath (exactly as if addSourcepath(root) had been called).
includeSourcePattern in interface JamServiceParamssourcepath - Root directory/ies containing source files.pattern - A relative file pattern (as described above under
'Include and Exclude Patterns').public void includeClassPattern(File[] classpath, String pattern)
JamServiceParamsincludeClassPattern in interface JamServiceParamsclasspath - Root directory of the source files.pattern - A relative file pattern (as described above under
'Include and Exclude Patterns').public void excludeSourcePattern(File[] sourcepath, String pattern)
JamServiceParamsexcludeSourcePattern in interface JamServiceParamssourcepath - Root directory of the source files.pattern - A relative file pattern (as described above under
'Include and Exclude Patterns').public void excludeClassPattern(File[] classpath, String pattern)
JamServiceParamsexcludeClassPattern in interface JamServiceParamsclasspath - Root directory of the source files.pattern - A relative file pattern (as described above under
'Include and Exclude Patterns').public void includeSourceFile(File[] sourcepath, File sourceFile)
JamServiceParamsIncludes 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).
includeSourceFile in interface JamServiceParamssourcepath - source sourcepath for the java source filesourceFile - the java source filepublic void excludeSourceFile(File[] sourcepath, File sourceFile)
JamServiceParamsExcludes a single source File in the JamService in exactly the same way theat includeSourceFile() includes a source file.
excludeSourceFile in interface JamServiceParamspublic void includeClassFile(File[] classpath, File classFile)
JamServiceParamsIncludes a single class File in the JamService in exactly the same way theat includeSourceFile() includes a source file.
includeClassFile in interface JamServiceParamspublic void excludeClassFile(File[] classpath, File classFile)
JamServiceParamsExcludes a single class File in the JamService in exactly the same way theat includeSourceFile() includes a source file.
excludeClassFile in interface JamServiceParamspublic void includeClass(String qualifiedClassname)
JamServiceParamsincludeClass in interface JamServiceParamsqualifiedClassname - a full-qualified classnamepublic void excludeClass(String qualifiedClassname)
JamServiceParamsexcludeClass in interface JamServiceParamsqualifiedClassname - a full-qualified classnamepublic void addClasspath(File classpathElement)
JamServiceParamsaddClasspath in interface JamServiceParamsclasspathElement - elements of the classpathpublic void setLoggerWriter(PrintWriter out)
JamServiceParamssetLoggerWriter in interface JamServiceParamsout - a PrintWriter to write topublic void setJamLogger(JamLogger logger)
JamServiceParamssetJamLogger in interface JamServiceParamspublic void addSourcepath(File sourcepathElement)
JamServiceParamsaddSourcepath in interface JamServiceParamspublic void addToolClasspath(File classpathElement)
JamServiceParamsAdds 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.
addToolClasspath in interface JamServiceParamsclasspathElement - elements of the classpathpublic void setProperty(String name, String value)
JamServiceParamsSets an implementation-specific property.
setProperty in interface JamServiceParamspublic void set14WarningsEnabled(boolean b)
JamServiceParamsSets whether warnings should be displayed when running under JDK 1.4. The default is true.
set14WarningsEnabled in interface JamServiceParamspublic void setParentClassLoader(JamClassLoader loader)
JamServiceParamssetParentClassLoader in interface JamServiceParamsloader - the parent loaerpublic void setUseSystemClasspath(boolean use)
JamServiceParamsSpecifies 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.
setUseSystemClasspath in interface JamServiceParamspublic void addClassLoader(ClassLoader cl)
JamServiceParamsaddClassLoader in interface JamServiceParamspublic ClassLoader[] getReflectionClassLoaders()
getReflectionClassLoaders in interface JamServiceContextpublic boolean is14WarningsEnabled()
is14WarningsEnabled in interface JamServiceContextpublic JamClassLoader getClassLoader()
ElementContextReturns the classloader the elements should use for type resolution.
getClassLoader in interface ElementContextpublic AnnotationProxy createAnnotationProxy(String jsr175typename)
ElementContextCreates an empty appropriate proxy for the given 175 annotation instance.
createAnnotationProxy in interface ElementContextCopyright © 2010 - 2020 Adobe. All Rights Reserved