background preloader

How to Write Doc Comments for the Javadoc Tool

How to Write Doc Comments for the Javadoc Tool
Javadoc Home Page This document describes the style guide, tag and image conventions we use in documentation comments for Java programs written at Java Software, Oracle. It does not rehash related material covered elsewhere: For reference material on Javadoc tags, see the Javadoc reference pages. For the required semantic content of documentation comments, see Requirements for Writing Java API Specifications. Contents Introduction Principles At Java Software, we have several guidelines that might make our documentation comments different than those of third party developers. Thus, there are commonly two different ways to write doc comments -- as API specifications, or as programming guide documentation. Writing API Specifications Ideally, the Java API Specification comprises all assertions required to do a clean-room implementation of the Java Platform for "write once, run anywhere" -- such that any Java applet or application will run the same on any implementation. Terminology javadoc getImage

How to Write an Action Listener (The Java™ Tutorials > Creating a GUI With JFC/Swing > Writing Event Listeners) Action listeners are probably the easiest — and most common — event handlers to implement. You implement an action listener to define what should be done when an user performs certain operation. An action event occurs, whenever an action is performed by the user. Examples: When the user clicks a button, chooses a menu item, presses Enter in a text field. The result is that an actionPerformed message is sent to all action listeners that are registered on the relevant component. To write an Action Listener, follow the steps given below: In general, to detect when the user clicks an onscreen button (or does the keyboard equivalent), a program must have an object that implements the ActionListener interface. Let us write a simple program which displays how many number of times a button is clicked by the user. public class AL extends Frame implements WindowListener,ActionListener { TextField text = new TextField(20); Button b; private int numClicks = 0; Here is the complete program(AL.java):

NetBeans - Javadoc support Javadoc supportNetBeans supports the Javadoc standard for Java documentation - both viewing it and generating it. It gives the student a solid documentation tool when working with code. Mounting and accessing Javadoc You may have noticed the Javadoc tab in the Explorer window. This operates much like the Filesystems tab where you mount source files, except here you mount directories containing Javadoc documentation. An empty directory is mounted there by default - this is where the IDE puts Javadoc documentation you generate for your own code (see below for details on generating Javadoc). You can also mount existing Javadoc documentation here (for example, the JDK documentation, or the Javadoc for the Open APIs for NetBeans). Generating Javadoc Javadoc documentation can be generated from specially formatted comments within source files.

YUIDoc - Javascript Documentation Tool Welcome to YUIDoc 0.10.0! YUIDoc is a Node.js application that generates API documentation from comments in source, using a syntax similar to tools like Javadoc and Doxygen. YUIDoc provides: Live previews. YUIDoc includes a standalone doc server, making it trivial to preview your docs as you write. Modern markup. Installation and Usage Download and install Node.js Run npm -g install yuidocjs. That's it! User Guides Using YUIDoc — Understanding YUIDoc command line arguments and usage. YUIDoc parses a modified form of JSDoc tags. Example Class Block /** * This is the description for my class. * * @class MyClass * @constructor */ Example Method Block /** * My method description. Example Property Block /** * My property description.

File Download In Spring In order to implement a file download in Spring, the key is returning null instead of a ModelAndView object. This controller that I created below is specifically for text/ascii data. You'd need to change the content type appropriately in order to download other file types. public class DownloadController implements Controller { /* * Spring dependency injection */ private XService xService; public void setxService( XService xService) { this.xService = xService; } public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String idStr = request.getParameter("id"); if (idStr ! private void doDownload(HttpServletRequest request, HttpServletResponse response, String data, String filename) throws IOException { int length = data.length(); ServletOutputStream op = response.getOutputStream(); byte[] bbuf = data.getBytes(); op.write(bbuf, 0, length); op.flush(); op.close(); }}

Gervill: Wiki: Home "Gervill" is a software sound synthesizer which was created as a proposal for the Audio Synthesis Engine Project. Example Applets Features Downloadable Sound Level 2.2 General Midi Level 2 MIDI Tuning Standard SoundFonts 2.04 (24 bit) Use Audio files (AIFF, AU and WAV) as SoundBanks Drumkits can be used on any channel Sinc interpolation with anti-aliasing Uses JavaSound mixers/lines for sound output Pure-Java implementation Emergency soundbank included MIDI Implementation Chart Usages Gervill was designed to be generic synthesizer for Java. Advanced features of Gervill are accessed thru the AudioSynthesizer interface.Warning! Gervill has been tested successfully with these applications: Project Overview Gervill project mainly consists of 3 modules: The SoundBank Readers/Writers Made of these classes: com.sun.media.sound.DLS* com.sun.media.sound.SF2* com.sun.media.sound.AudioFileSoundbankReader There is a one SoundBank reader/writer for each soundbank format which Gervill supports. License

SHA512 Encrypt hash in JavaScript The SHA (Secure Hash Algorithm) can be used to encrypt data for secure transfer between applications. The SHA512() function returns a string with the SHA512 encrypted hash as a 128-character hexadecimal string. It is fully compatible with UTF-8 encoding. Code of the SHA512() function - Usage: 1. - Example. <form action="#" method="post"> Enter a text:<br/><input type="text" name="strex" id="strex" size="20" /><button id="cryptstr">Encrypt</button><br/> SHA512 hash string:<br/><input type="text" name="strcrypt" id="strcrypt" size="33" /></form><script type="text/javascript"> // Here add the code of SHA512 function // register onclick events for Encrypt button document.getElementById('cryptstr').onclick = function() { var txt_string = document.getElementById('strex').value; // gets data from input text // encrypts data and adds it in #strcrypt element document.getElementById('strcrypt').value = SHA512(txt_string); return false; } </script> Demo:

JUnit JUnit a été initialement développé par Erich Gamma et Kent Beck. JUnit propose : Un framework pour le développement des tests unitaires reposant sur des assertions qui testent les résultats attendus Des applications pour permettre l'exécution des tests et afficher les résultats Le but est d'automatiser les tests. Cela permet de séparer le code de la classe, du code qui permet de la tester. La rédaction de cas de tests peut avoir un effet immédiat pour détecter des bugs mais surtout elle a un effet à long terme qui facilite la détection d'effets de bords lors de modifications. Les cas de tests sont regroupés dans des classes Java qui contiennent une ou plusieurs méthodes de tests. JUnit permet le développement incrémental d'une suite de tests. Avec JUnit, l'unité de test est une classe dédiée qui regroupe des cas de tests. La version utilisée dans ce chapitre est la 3.8.1 sauf dans la section dédiée à la version 4 de JUnit. La page officielle est à l'url : 92.1. 92.2. 92.3.

jQuery prop('checked') vs. is(':checked') Info A quick test to see if prop('checked') or is(':checked') is faster with jQuery. Preparation code <input type="checkbox" value="y" name="my-test-checkbox" id="my-test-checkbox" checked><script> var $el = $('#my-test-checkbox');</script> Preparation code output Test runner Warning! Java applet disabled. Ready to run. Compare results of other browsers Chart type: bar, column, line, pie, tableFilter: popular, all, desktop, family, major, minor, mobile, prerelease Revisions You can edit these tests or add even more tests to this page by appending /edit to the URL.

JUnit Cookbook Kent Beck, Erich Gamma Here is a short cookbook showing you the steps you can follow in writing and organizing your own tests using JUnit. Simple Test Case How do you write testing code? The simplest way is as an expression in a debugger. You can change debug expressions without recompiling, and you can wait to decide what to write until you have seen the running objects. JUnit tests do not require human judgment to interpret, and it is easy to run many of them at the same time. Annotate a method with @org.junit.Test When you want to check a value, import org.junit.Assert.* statically, call assertTrue() and pass a boolean that is true if the test succeeds For example, to test that the sum of two Moneys with the same currency contains a value which is the sum of the values of the two Moneys, write: If you want to write a test similar to one you have already written, write a Fixture instead. Fixture What if you have two or more tests that operate on the same or similar sets of objects?

How to check a not defined variable in javascript JUnit: A Cook’s Tour Note: this article is based on JUnit 3.8.x. 1. Introduction In an earlier article (see Test Infected: Programmers Love Writing Tests, Java Report, July 1998, Volume 3, Number 7), we described how to use a simple framework to write repeatable tests. We carefully studied the JUnit framework and reflected on how we constructed it. We open with a discussion of the goals of the framework. 2. What are the goals of JUnit? First, we have to get back to the assumptions of development. From this perspective, developers aren’t done when they write and debug the code, they must also write tests that demonstrate that the program works. So, the number one goal is to write a framework within which we have some glimmer of hope that developers will actually write tests. If this was all tests had to do, you would be done just by writing expressions in a debugger. So, the second goal of testing is creating tests that retain their value over time. 3. 3.1 Getting started- TestCase 3.2 Blanks to fill in- run()

Google Maps JavaScript API v3 Release Version Last updated Monday, February 17, 2014 This reference documents version 3.15 (the release version) of the Maps Javascript API released November 15, 2013. This release version of the API is a feature-stable version of the API whose interfaces are guaranteed to remain as documented within these pages until this version is retired. To consult the latest (experimental) version of the Maps Javascript API, see the Experimental Development Reference. Reference Table of Contents Map Controls Overlays Services Map Types Layers Street View Events Base Geometry Library AdSense Library Panoramio Library Places Library Drawing Library Weather Library Visualization Library google.maps.Map class This class extends MVCObject. Constructor Methods Properties Events google.maps.MapOptions object specification google.maps.MapTypeId class Identifiers for common MapTypes. Constant google.maps.MapTypeControlOptions object specification Options for the rendering of the map type control. google.maps.MapTypeControlStyle class

Overview of Interceptors - The Java EE 6 Tutorial Interceptors are used in conjunction with Java EE managed classes to allow developers to invoke interceptor methods on an associated target class, in conjunction with method invocations or lifecycle events. Common uses of interceptors are logging, auditing, and profiling. The Interceptors 1.1 specification is part of the final release of JSR 318, Enterprise JavaBeans 3.1, available from An interceptor can be defined within a target class as an interceptor method, or in an associated class called an interceptor class. Interceptor classes and methods are defined using metadata annotations, or in the deployment descriptor of the application containing the interceptors and target classes. Note - Applications that use the deployment descriptor to define interceptors are not portable across Java EE servers. Interceptor methods within the target class or in an interceptor class are annotated with one of the metadata annotations defined in Table 50-1.

Related: