<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0) on Thu Mar 06 17:19:15 EST 2008 -->
<TITLE>
ClassCompiler (Rhino)
</TITLE>
<META NAME="date" CONTENT="2008-03-06">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ClassCompiler (Rhino)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV CLASS
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/mozilla/javascript/optimizer/ClassCompiler.html" target="_top"><B>FRAMES</B></A>
<A HREF="ClassCompiler.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.mozilla.javascript.optimizer</FONT>
<BR>
Class ClassCompiler</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>org.mozilla.javascript.optimizer.ClassCompiler</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>ClassCompiler</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
Generates class files from script sources.
since 1.5 Release 5
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>Igor Bukanov</DD>
</DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#ClassCompiler(org.mozilla.javascript.CompilerEnvirons)">ClassCompiler</A></B>(<A HREF="../../../../org/mozilla/javascript/CompilerEnvirons.html" title="class in org.mozilla.javascript">CompilerEnvirons</A> compilerEnv)</CODE>
<BR>
Construct ClassCompiler that uses the specified compiler environment
when generating classes.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.Object[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#compileToClassFiles(java.lang.String, java.lang.String, int, java.lang.String)">compileToClassFiles</A></B>(java.lang.String source,
java.lang.String sourceLocation,
int lineno,
java.lang.String mainClassName)</CODE>
<BR>
Compile JavaScript source into one or more Java class files.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../org/mozilla/javascript/CompilerEnvirons.html" title="class in org.mozilla.javascript">CompilerEnvirons</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#getCompilerEnv()">getCompilerEnv</A></B>()</CODE>
<BR>
Get the compiler environment the compiler uses.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#getMainMethodClass()">getMainMethodClass</A></B>()</CODE>
<BR>
Get the name of the class for main method implementation.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.Class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#getTargetExtends()">getTargetExtends</A></B>()</CODE>
<BR>
Get the class that the generated target will extend.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.Class[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#getTargetImplements()">getTargetImplements</A></B>()</CODE>
<BR>
Get the interfaces that the generated target will implement.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#makeAuxiliaryClassName(java.lang.String, java.lang.String)">makeAuxiliaryClassName</A></B>(java.lang.String mainClassName,
java.lang.String auxMarker)</CODE>
<BR>
Build class name for a auxiliary class generated by compiler.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#setMainMethodClass(java.lang.String)">setMainMethodClass</A></B>(java.lang.String className)</CODE>
<BR>
Set the class name to use for main method implementation.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#setTargetExtends(java.lang.Class)">setTargetExtends</A></B>(java.lang.Class extendsClass)</CODE>
<BR>
Set the class that the generated target will extend.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#setTargetImplements(java.lang.Class[])">setTargetImplements</A></B>(java.lang.Class[] implementsClasses)</CODE>
<BR>
Set the interfaces that the generated target will implement.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="ClassCompiler(org.mozilla.javascript.CompilerEnvirons)"><!-- --></A><H3>
ClassCompiler</H3>
<PRE>
public <B>ClassCompiler</B>(<A HREF="../../../../org/mozilla/javascript/CompilerEnvirons.html" title="class in org.mozilla.javascript">CompilerEnvirons</A> compilerEnv)</PRE>
<DL>
<DD>Construct ClassCompiler that uses the specified compiler environment
when generating classes.
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="setMainMethodClass(java.lang.String)"><!-- --></A><H3>
setMainMethodClass</H3>
<PRE>
public void <B>setMainMethodClass</B>(java.lang.String className)</PRE>
<DL>
<DD>Set the class name to use for main method implementation.
The class must have a method matching
<tt>public static void main(Script sc, String[] args)</tt>, it will be
called when <tt>main(String[] args)</tt> is called in the generated
class. The class name should be fully qulified name and include the
package name like in <tt>org.foo.Bar<tt>.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getMainMethodClass()"><!-- --></A><H3>
getMainMethodClass</H3>
<PRE>
public java.lang.String <B>getMainMethodClass</B>()</PRE>
<DL>
<DD>Get the name of the class for main method implementation.
<P>
<DD><DL>
<DT><B>See Also:</B><DD><A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#setMainMethodClass(java.lang.String)"><CODE>setMainMethodClass(String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getCompilerEnv()"><!-- --></A><H3>
getCompilerEnv</H3>
<PRE>
public <A HREF="../../../../org/mozilla/javascript/CompilerEnvirons.html" title="class in org.mozilla.javascript">CompilerEnvirons</A> <B>getCompilerEnv</B>()</PRE>
<DL>
<DD>Get the compiler environment the compiler uses.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getTargetExtends()"><!-- --></A><H3>
getTargetExtends</H3>
<PRE>
public java.lang.Class <B>getTargetExtends</B>()</PRE>
<DL>
<DD>Get the class that the generated target will extend.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setTargetExtends(java.lang.Class)"><!-- --></A><H3>
setTargetExtends</H3>
<PRE>
public void <B>setTargetExtends</B>(java.lang.Class extendsClass)</PRE>
<DL>
<DD>Set the class that the generated target will extend.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>extendsClass</CODE> - the class it extends</DL>
</DD>
</DL>
<HR>
<A NAME="getTargetImplements()"><!-- --></A><H3>
getTargetImplements</H3>
<PRE>
public java.lang.Class[] <B>getTargetImplements</B>()</PRE>
<DL>
<DD>Get the interfaces that the generated target will implement.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setTargetImplements(java.lang.Class[])"><!-- --></A><H3>
setTargetImplements</H3>
<PRE>
public void <B>setTargetImplements</B>(java.lang.Class[] implementsClasses)</PRE>
<DL>
<DD>Set the interfaces that the generated target will implement.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>implementsClasses</CODE> - an array of Class objects, one for each
interface the target will extend</DL>
</DD>
</DL>
<HR>
<A NAME="makeAuxiliaryClassName(java.lang.String, java.lang.String)"><!-- --></A><H3>
makeAuxiliaryClassName</H3>
<PRE>
protected java.lang.String <B>makeAuxiliaryClassName</B>(java.lang.String mainClassName,
java.lang.String auxMarker)</PRE>
<DL>
<DD>Build class name for a auxiliary class generated by compiler.
If the compiler needs to generate extra classes beyond the main class,
it will call this function to build the auxiliary class name.
The default implementation simply appends auxMarker to mainClassName
but this can be overridden.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="compileToClassFiles(java.lang.String, java.lang.String, int, java.lang.String)"><!-- --></A><H3>
compileToClassFiles</H3>
<PRE>
public java.lang.Object[] <B>compileToClassFiles</B>(java.lang.String source,
java.lang.String sourceLocation,
int lineno,
java.lang.String mainClassName)</PRE>
<DL>
<DD>Compile JavaScript source into one or more Java class files.
The first compiled class will have name mainClassName.
If the results of <A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#getTargetExtends()"><CODE>getTargetExtends()</CODE></A> or
<A HREF="../../../../org/mozilla/javascript/optimizer/ClassCompiler.html#getTargetImplements()"><CODE>getTargetImplements()</CODE></A> are not null, then the first compiled
class will extend the specified super class and implement
specified interfaces.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>array where elements with even indexes specifies class name
and the following odd index gives class file body as byte[]
array. The initial element of the array always holds
mainClassName and array[1] holds its byte code.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV CLASS
NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/mozilla/javascript/optimizer/ClassCompiler.html" target="_top"><B>FRAMES</B></A>
<A HREF="ClassCompiler.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>