de.hunsicker.jalopy.plugin.ant
Class AntPlugin

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--de.hunsicker.jalopy.plugin.ant.AntPlugin

public class AntPlugin
extends org.apache.tools.ant.Task

The Jalopy Ant Plug-in. Formats Java source files according to some user configurable rules. For more information about the Jalopy Java Source Code Formatter visit the official homepage: http://jalopy.sf.net/

Version:
$Revision: 1.7 $
Author:
Marco Hunsicker

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
AntPlugin()
          Creates a new AntPlugin object.
 
Method Summary
 void addFileset(org.apache.tools.ant.types.FileSet set)
          Adds a set of files (nested fileset attribute).
 void execute()
          Executes the task.
 void init()
          Initializes the task.
 void setBackup(boolean backup)
          Sets whether a backup of an original file should be kept.
 void setClasspathRef(org.apache.tools.ant.types.Reference reference)
          Set the reference to the project classpath.
 void setConvention(java.lang.String location)
          Sets the location of the code convention to use.
 void setDestdir(java.io.File destDir)
          Sets the destination directory into which the Java source files should be formatted.
 void setEncoding(java.lang.String encoding)
          Sets the encoding to use.
 void setFailOnError(boolean fail)
          Sets whether an error will immediately cancel the run.
 void setFile(java.io.File file)
          Sets a single source file to format.
 void setFileFormat(java.lang.String fileFormat)
          Sets the file format to use.
 void setForce(boolean force)
          Controls whether all files should always be formatted.
 void setFork(boolean fork)
          Sets the fork attribute.
 void setHistory(java.lang.String policy)
          Sets the history policy to use.
 void setHistoryMethod(java.lang.String method)
          Sets the history method to use.
 void setJavadoc(boolean javadoc)
          Sets whether Javadoc related messages should be displayed.
 void setLoglevel(java.lang.String level)
          Sets the level to control logging output.
 void setStyle(java.lang.String location)
          Deprecated.  
 void setThreads(java.lang.String threads)
          Sets the number of processing threads to use.
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntPlugin

public AntPlugin()
Creates a new AntPlugin object.

Method Detail

setBackup

public void setBackup(boolean backup)
Sets whether a backup of an original file should be kept.

Parameters:
backup - if true a backup of an original file will be kept.

setClasspathRef

public void setClasspathRef(org.apache.tools.ant.types.Reference reference)
Set the reference to the project classpath.

Parameters:
reference - project classpath reference.
Since:
0.5.3

setConvention

public void setConvention(java.lang.String location)
Sets the location of the code convention to use. This may either be an absolute path to both a local file or distributed url or a path relative to the base directory of the project.

Parameters:
location - absolute or relative path to load style convention from.
Since:
0.5.5

setDestdir

public void setDestdir(java.io.File destDir)
Sets the destination directory into which the Java source files should be formatted.

Parameters:
destDir - destination directory.
See Also:
Jalopy.setDestination(java.io.File)

setEncoding

public void setEncoding(java.lang.String encoding)
Sets the encoding to use.

Parameters:
encoding - encoding to use.
See Also:
Jalopy.setEncoding(java.lang.String)

setFailOnError

public void setFailOnError(boolean fail)
Sets whether an error will immediately cancel the run. Default is false.

Parameters:
fail - if true an error will lead to an immediate cancelation of the run.

setFile

public void setFile(java.io.File file)
Sets a single source file to format.

Parameters:
file - the file to format.
Throws:
java.lang.IllegalArgumentException - if the file does not exist.
See Also:
Jalopy.setInput(File)

setFileFormat

public void setFileFormat(java.lang.String fileFormat)
Sets the file format to use. Default is AUTO.

Parameters:
fileFormat - format to use.
Throws:
java.lang.IllegalArgumentException - if an invalid file format was given
See Also:
Jalopy.setFileFormat(String)

setForce

public void setForce(boolean force)
Controls whether all files should always be formatted.

Parameters:
force - if true all files are always formatted.
See Also:
Jalopy.setForce(boolean)

setFork

public void setFork(boolean fork)
Sets the fork attribute.

Parameters:
fork - if true the task will be executed in a new process.
Since:
0.5.3

setHistory

public void setHistory(java.lang.String policy)
Sets the history policy to use.

Parameters:
policy - Either
  • COMMENT or
  • FILE or
  • NONE
Throws:
java.lang.IllegalArgumentException - if an invalid history policy is specified.

setHistoryMethod

public void setHistoryMethod(java.lang.String method)
Sets the history method to use.

Parameters:
method - Either
  • timestamp or
  • crc32 or
  • adler32
Throws:
java.lang.IllegalArgumentException - if an invalid history method is specified.
Since:
0.5.5

setJavadoc

public void setJavadoc(boolean javadoc)
Sets whether Javadoc related messages should be displayed. Default is true.

Note that setting this switch to false means that no Javadoc related messages will be displayed no matter what ever happens! Even if formatting failed due to Javadoc parsing errors, there will be no output indicating this fact.

Parameters:
javadoc - if true Javadoc messages will be displayed.

setLoglevel

public void setLoglevel(java.lang.String level)
Sets the level to control logging output. The valid levels are being ERROR the highest level and DEBUG the lowest level.

Enabling logging at a given level also enables logging at all higher levels.

Parameters:
level - the logging level to use.
Throws:
java.lang.IllegalArgumentException - if an invalid logging level has been specified.

setStyle

public void setStyle(java.lang.String location)
Deprecated.  

Sets the location of the code convention to use. This may either be an absolute path to both a local file or distributed url or a path relative to the base directory of the project.

Parameters:
location - absolute or relative path to load style convention from.

setThreads

public void setThreads(java.lang.String threads)
Sets the number of processing threads to use.

Parameters:
threads - the thread count to use. A number between 1 and 8.
Throws:
java.lang.IllegalArgumentException - if threads < 1 or threads > 8

addFileset

public void addFileset(org.apache.tools.ant.types.FileSet set)
Adds a set of files (nested fileset attribute).

Parameters:
set - fileset to add.

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Executes the task.

Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException - if someting goes wrong with the build.

init

public void init()
          throws org.apache.tools.ant.BuildException
Initializes the task.

Overrides:
init in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException - if the initialization failed.


Copyright © 1997-2005 Jalopy. All Rights Reserved.