Classhat(tm) Java Specifics compiler</a> <!-- Stylesheet --> <link rel="stylesheet" type="text/css" href="http://www.classhat.com/style.css"> <!-- Stylesheet --> <table class=bodytext> <tr><td> <table><tr> <td> <img src=http://www.classhat.com/images/logo.jpg> </td> <td width=110></td> <td> <!-- GOOG AD --> <script type="text/javascript"><!-- google_ad_client = "pub-8366735459736268"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; google_ad_channel ="8663606004"; google_color_border = "336699"; google_color_bg = "FFFFFF"; google_color_link = "0000FF"; google_color_url = "008000"; google_color_text = "000000"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </td></tr> </table> </tr> <tr> <table class=bodytext> <tr> <tr><td valign=top width=210> <!-- MENU --> Java Specifics<img src=images/tm.png> Compilation Engine<br> <hr> <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "UA-170806-7"; urchinTracker(); </script> <a href=http://www.classhat.com>Home</a><br> <a href=http://www.classhat.com/faq.jsp>FAQ</a><br> <a href=http://www.classhat.com/download.jsp><b>Download</b></a><br> <!-- a href=http://www.outscheme.com/classhatforums>Forums</a><br --> <a href=http://www.classhat.com/javaspecifics.pdf>Whitepaper - Read First (pdf)</a><br> <!-- a href=http://www.classhat.com/SpecWriting.pdf>Howto Write Specifics (pdf)</a><br --> <br> <form name="search" method=get action="/index.jsp"> Package to import:<br> <form name="search" method=get action="/index.jsp"> <input type="radio" name="imp" value="java.io"/> java.io.*<br> <input type="radio" name="imp" value="java.awt"/> java.awt.*<br> <input type="radio" name="imp" value="java.util"/> java.util.*<br> <input type="radio" name="imp" value="java.sql"/> java.sql.*<br> <input type="radio" name="imp" value="javax.crypto"/> javax.crypto.*<br> <br> Enter classname to generate: <input type="text" class="textfield" name="classname" size="45" maxlength=55> <br> <input type="checkbox" name="mock" checked="true">mock nonexistent classes<br> </form> <hr> Available Specifics:<br> <b>{AnyString}</b>World  <font class=bodysma> <a href=/specs/SpecificWorld.spec><img src=images/text.png border=0></a></font><br> <b>{AnyClass}</b>ArrayList  <font class=bodysma> <a href=/specs/SpecificArrayList.spec><img src=images/text.png border=0></a></font><br> <b>{AnyPrimitive}</b>ArrayList  <font class=bodysma> <a href=/specs/PrimitiveSpecificArrayList.spec><img src=images/text.png border=0></a></font><br> <b>{AnyClass}</b>LinkedList  <font class=bodysma> <a href=/specs/SpecificLinkedList.spec><img src=images/text.png border=0></a></font><br> <b>{AnyPrimitive}</b>LinkedList  <font class=bodysma> <a href=/specs/PrimitiveSpecificLinkedList.spec><img src=images/text.png border=0></a></font><br> <hr> Contact:<br> classhat at outscheme.com </td> <!-- vertical spacer --> <td width=30></td> <td valign=top> <!-- Main area --> <p><b>What is this all about??</b></p> <p>This system provides you the ability to generate classes based on some template. For example, let's say you want a StringArrayList but can't use JDK1.5 generics. This system can (with one command) generate that class and appropriate iterators. <br><br> The generated class will <b>truly be</b> an arraylist of strings (and only strings). It can be cast to a regular ArrayList (or List) and operate just fine. Not only can specifics be used to emulate generics, but since they "really are" typed collections, they are faster and in some senses more secure than generics (and can be used with Java prior to release 1.5).<br><br> You are not limited to collections either. You can generate any type of class. Try the "DogWorld" example on the left. </p> <p><b>What is Classhat?</b></p> <p>Classhat is a compilation engine for Java Specifics. Java Specifics is a Java source code templating system. Note that classhat is often termed a "compiler", this is not technically correct as it uses some other java compiler under the hood. However its use looks and feels like it is a compiler. <br><br> You can use this online version -or- download the application itself, generate specifics on your own machine and write your own specific templates! </p> <br><p><b>What are 'Available Specifics' on the left sidebar?</b></p> <p>The classhat compiler requires input specifics (i.e., templates) in order to generate classes. Theses specifics might be provided with the compilation engine -or- could be written by you or third-parties. <br><br> On this online version, only the specifics provided may be used. They are listed as 'Available'. </p> <br><p><b>So I can use classhat in this online version OR as a command-line tool?</b></p> <p>Right. The command-line tool will prove to be far more useful as you can write and configure exactly which specifics are available. <br><br> Use the online version by just typing in a class name on the left. Download the actual application (also on the left) to use it on your own machine. </p> <br><p><b>So what should I enter in the "classname to generate" box?</b></p> <p>Take a look at the available specifics and see what each one accepts. For example {AnyClass}LinkedList takes the name of any class that classhat can find. If you enter a classname it cannot find (or otherwise random string) you will see the compiler output indicating this when you hit enter. Try entering StringLinkedList - since classhat can find java.lang.String, it should generate the classes without a problem. <br><br> Note that classhat can find classes that it has just generated. So you could enter StringLinkedListLinkedList - which is of course a linked list of linked lists of Strings. <br><br> If you wish classhat to search in other packages, you can use the importing radio buttons on the sidebar to have it insert that in the code prior to compilation. </p> <br><p><b>I want to import a package something not in the list on the left!</b></p> <p>Just sneak it into the URL in the 'imp=' parameter.</p> <br><p><b>This interface only allows me to use classes from the standard Java packages. How can I make a MyClassArrayList?</b></p> <p>Either turn on mock generation of classes (i.e., checkbox on the sidebar) or download the application which can then see your classpath.</p> <br><p><b>How do I generate a class so its not in the default package?</b></p> <p>Just ask for it. If you type in StringArrayList, it will be in the default package. If you type in com.yourcompany.StringArrayList, it will be in the com.yourcompany package.</p> <br><p><b>Can I run the classes that are generated?</b></p> <p>If they are executable, yes. Obviously, many collections classes aren't usually executable. But the {AnyString}World specific is. Try CarWorld or HelloWorld or SomeWeirdCrazyWorld. Download the class and execute it.</p> <br><p><b>What exactly are 'specifics'?</b></p> <p>They are Java source code templates. Click the icon next to each name in the 'Available Specifics' at the left to see their source code. They look pretty much like standard Java with bracketed strings sprinkled throughout.</p> <br><p><b>You give the source, but it says I probably can't compile it. Why not?</b></p> <p>Actually - you almost always can compile it, but it might not execute correctly if you do it that way. The specifics engine always outputs valid Java code. And in many cases such as the {AnyString}World specific, you can compile and run that source yourself. <br><br> But classhat has a post-processing phase that won't happen if you use your own compiler. Technically speaking, you will lose return type covariance if you do not use the classes generated by classhat. To illustrate that lets say you have a StringArrayList called myStringArrayList and you have the command:<br><br> String xyz = myStringArrayList.get(0);<br><br> There is no cast and this works fine on classhat generated classes. However, this will not work fine if you compile the source yourself.</p> </td></tr></table> </td></tr></table> <br><br> <center> <hr> <font class=copyright>Copyright 2006 Outscheme, Inc. All Rights Reserved. Java is a trademark of Sun Microsystems. All trademarks property of their respective owners.</font> </center> </body> </html>