public class JStaticJavaFile extends AbstractJResourceFile
This AbstractJResourceFile
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 AbstractJClass
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
AbstractJClass
object doesn't respond to methods like "isInterface"
or "_extends",
Modifier and Type | Class and Description |
---|---|
static class |
JStaticJavaFile.ChainFilter
A
JStaticJavaFile.ILineFilter that combines two JStaticJavaFile.ILineFilter s. |
static interface |
JStaticJavaFile.ILineFilter
Filter that alters the Java source code.
|
Constructor and Description |
---|
JStaticJavaFile(JPackage aPkg,
String sClassName,
String sResourceName) |
JStaticJavaFile(JPackage aPkg,
String sClassName,
URL aSource,
JStaticJavaFile.ILineFilter aFilter) |
Modifier and Type | Method and Description |
---|---|
protected void |
build(OutputStream os)
called by
JPackage to produce the file image. |
AbstractJClass |
getJClass() |
protected boolean |
isResource() |
name
public JStaticJavaFile(@Nonnull JPackage aPkg, @Nonnull String sClassName, @Nonnull String sResourceName)
@Nonnull public final AbstractJClass getJClass()
protected boolean isResource()
isResource
in class AbstractJResourceFile
true
if this file should be generated into the
directory that the resource files go into. false
if
this file should be generated into the directory where other source
files go.protected void build(@Nonnull OutputStream os) throws IOException
AbstractJResourceFile
JPackage
to produce the file image.build
in class AbstractJResourceFile
os
- OutputStream to write toIOException
- If writing on the stream throws an errorCopyright © 2013–2015 Philip Helger. All rights reserved.