Class JStaticJavaFile
This JResourceFile implementation will generate a Java source
file by copying the source code from a resource.
While copying a resource, we look for a package declaration and replace it with the target package name. This allows the static Java source code to have an arbitrary package declaration.
You can also use the getJClass method to obtain a JClass
object that represents the static file. This allows the client code
to refer to the class from other CodeModel generated code.
Note that because we don't parse the static Java source code,
the returned JClass object doesn't respond to methods like
"isInterface" or "_extends",
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAJStaticJavaFile.LineFilterthat combines twoJStaticJavaFile.LineFilters.private classstatic interfaceFilter that alters the Java source code. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final JStaticJavaFile.JStaticClassprivate final JStaticJavaFile.LineFilterprivate final JPackageprivate final URL -
Constructor Summary
ConstructorsConstructorDescriptionJStaticJavaFile(JPackage _pkg, String className, String _resourceName) JStaticJavaFile(JPackage _pkg, String _className, URL _source, JStaticJavaFile.LineFilter _filter) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuild(OutputStream os) called by JPackage to produce the file image.private JStaticJavaFile.LineFilterCreates aJStaticJavaFile.LineFilter.final JClassReturns a class object that represents a statically generated code.protected booleanReturns true if this file should be generated into the directory that the resource files go into.Methods inherited from class JResourceFile
name
-
Field Details
-
pkg
-
className
-
source
-
clazz
-
filter
-
-
Constructor Details
-
JStaticJavaFile
-
JStaticJavaFile
public JStaticJavaFile(JPackage _pkg, String _className, URL _source, JStaticJavaFile.LineFilter _filter)
-
-
Method Details
-
getJClass
Returns a class object that represents a statically generated code. -
isResource
protected boolean isResource()Description copied from class:JResourceFileReturns true if this file should be generated into the directory that the resource files go into.Returns false if this file should be generated into the directory where other source files go.
- Overrides:
isResourcein classJResourceFile
-
build
Description copied from class:JResourceFilecalled by JPackage to produce the file image.- Specified by:
buildin classJResourceFile- Throws:
IOException
-
createLineFilter
Creates aJStaticJavaFile.LineFilter.A derived class can override this method to process the contents of the source file.
-