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",
Constructor and Description |
---|
JStaticJavaFile(JPackage aPkg,
String sClassName,
String sResourceName) |
JStaticJavaFile(JPackage aPkg,
String sClassName,
URL aSource,
Function<String,String> aFilter) |
Modifier and Type | Method and Description |
---|---|
void |
build(OutputStream aOS)
called by
JPackage to produce the file image. |
AbstractJClass |
getJClass() |
boolean |
isResource() |
name
public JStaticJavaFile(@Nonnull JPackage aPkg, @Nonnull String sClassName, @Nonnull String sResourceName)
@Nonnull public final AbstractJClass getJClass()
public final 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.public void build(@Nonnull @WillNotClose OutputStream aOS) throws IOException
AbstractJResourceFile
JPackage
to produce the file image.build
in class AbstractJResourceFile
aOS
- OutputStream to write toIOException
- If writing on the stream throws an errorCopyright © 2013–2019 Philip Helger. All rights reserved.