Browse Source

checkstyle javadoc

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278436 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 20 years ago
parent
commit
1e2673a7ea
5 changed files with 128 additions and 23 deletions
  1. +24
    -12
      src/main/org/apache/tools/ant/taskdefs/Tstamp.java
  2. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/email/Message.java
  3. +35
    -6
      src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  4. +45
    -3
      src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
  5. +21
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java

+ 24
- 12
src/main/org/apache/tools/ant/taskdefs/Tstamp.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2004 The Apache Software Foundation
* Copyright 2000-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -47,7 +47,8 @@ public class Tstamp extends Task {


/** /**
* Set a prefix for the properties. If the prefix does not end with a "." * Set a prefix for the properties. If the prefix does not end with a "."
* one is automatically added
* one is automatically added.
* @param prefix the prefix to use.
* @since Ant 1.5 * @since Ant 1.5
*/ */
public void setPrefix(String prefix) { public void setPrefix(String prefix) {
@@ -60,7 +61,7 @@ public class Tstamp extends Task {
/** /**
* create the timestamps. Custom ones are done before * create the timestamps. Custom ones are done before
* the standard ones, to get their retaliation in early. * the standard ones, to get their retaliation in early.
* @throws BuildException
* @throws BuildException on error.
*/ */
public void execute() throws BuildException { public void execute() throws BuildException {
try { try {
@@ -132,7 +133,7 @@ public class Tstamp extends Task {


/** /**
* The property to receive the date/time string in the given pattern * The property to receive the date/time string in the given pattern
* @param propertyName
* @param propertyName the name of the property.
*/ */
public void setProperty(String propertyName) { public void setProperty(String propertyName) {
this.propertyName = propertyName; this.propertyName = propertyName;
@@ -182,7 +183,7 @@ public class Tstamp extends Task {
/** /**
* The timezone to use for displaying time. * The timezone to use for displaying time.
* The values are as defined by the Java TimeZone class. * The values are as defined by the Java TimeZone class.
* @param id
* @param id the timezone value.
* @see java.util.TimeZone * @see java.util.TimeZone
*/ */
public void setTimezone(String id) { public void setTimezone(String id) {
@@ -191,13 +192,15 @@ public class Tstamp extends Task {


/** /**
* The numeric offset to the current time. * The numeric offset to the current time.
* @param offset
* @param offset the offset to use.
*/ */
public void setOffset(int offset) { public void setOffset(int offset) {
this.offset = offset; this.offset = offset;
} }


/** /**
* Set the unit type (using String).
* @param unit the unit to use.
* @deprecated setUnit(String) is deprecated and is replaced with * @deprecated setUnit(String) is deprecated and is replaced with
* setUnit(Tstamp.Unit) to make Ant's * setUnit(Tstamp.Unit) to make Ant's
* Introspection mechanism do the work and also to * Introspection mechanism do the work and also to
@@ -226,16 +229,16 @@ public class Tstamp extends Task {
* <li>year</li> * <li>year</li>
* </ul> * </ul>
* The default unit is day. * The default unit is day.
* @param unit
* @param unit the unit to use.
*/ */
public void setUnit(Unit unit) { public void setUnit(Unit unit) {
field = unit.getCalendarField(); field = unit.getCalendarField();
} }


/** /**
* validate parameter and execute the format
* @param project project to set property in
* @param date date to use as a starting point
* validate parameter and execute the format.
* @param project project to set property in.
* @param date date to use as a starting point.
* @param location line in file (for errors) * @param location line in file (for errors)
*/ */
public void execute(Project project, Date date, Location location) { public void execute(Project project, Date date, Location location) {
@@ -287,7 +290,7 @@ public class Tstamp extends Task {
private static final String MONTH = "month"; private static final String MONTH = "month";
private static final String YEAR = "year"; private static final String YEAR = "year";


private static final String[] units = {
private static final String[] UNITS = {
MILLISECOND, MILLISECOND,
SECOND, SECOND,
MINUTE, MINUTE,
@@ -300,6 +303,7 @@ public class Tstamp extends Task {


private Hashtable calendarFields = new Hashtable(); private Hashtable calendarFields = new Hashtable();


/** Constructor for Unit enumerated type. */
public Unit() { public Unit() {
calendarFields.put(MILLISECOND, calendarFields.put(MILLISECOND,
new Integer(Calendar.MILLISECOND)); new Integer(Calendar.MILLISECOND));
@@ -312,14 +316,22 @@ public class Tstamp extends Task {
calendarFields.put(YEAR, new Integer(Calendar.YEAR)); calendarFields.put(YEAR, new Integer(Calendar.YEAR));
} }


/**
* Convert the value to int unit value.
* @return an int value.
*/
public int getCalendarField() { public int getCalendarField() {
String key = getValue().toLowerCase(); String key = getValue().toLowerCase();
Integer i = (Integer) calendarFields.get(key); Integer i = (Integer) calendarFields.get(key);
return i.intValue(); return i.intValue();
} }


/**
* Get the valid values.
* @return the value values.
*/
public String[] getValues() { public String[] getValues() {
return units;
return UNITS;
} }
} }
} }

+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/email/Message.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2004 The Apache Software Foundation
* Copyright 2002-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -145,9 +145,11 @@ public class Message extends ProjectComponent {
public boolean isMimeTypeSpecified() { public boolean isMimeTypeSpecified() {
return specified; return specified;
} }

/** /**
* Sets the character set of mail message. * Sets the character set of mail message.
* Will be ignored if mimeType contains ....; Charset=... substring. * Will be ignored if mimeType contains ....; Charset=... substring.
* @param charset the character set name.
* @since Ant 1.6 * @since Ant 1.6
*/ */
public void setCharset(String charset) { public void setCharset(String charset) {


+ 35
- 6
src/main/org/apache/tools/ant/taskdefs/optional/Javah.java View File

@@ -86,6 +86,7 @@ public class Javah extends Task {


/** /**
* the fully-qualified name of the class (or classes, separated by commas). * the fully-qualified name of the class (or classes, separated by commas).
* @param cls the classname (or classnames).
*/ */
public void setClass(String cls) { public void setClass(String cls) {
this.cls = cls; this.cls = cls;
@@ -93,6 +94,7 @@ public class Javah extends Task {


/** /**
* Adds class to process. * Adds class to process.
* @return a <code>ClassArgument</code> to be configured.
*/ */
public ClassArgument createClass() { public ClassArgument createClass() {
ClassArgument ga = new ClassArgument(); ClassArgument ga = new ClassArgument();
@@ -100,16 +102,29 @@ public class Javah extends Task {
return ga; return ga;
} }


/**
* A class corresponding the the nested "class" element.
* It contains a "name" attribute.
*/
public class ClassArgument { public class ClassArgument {
private String name; private String name;


/** Constructor for ClassArgument. */
public ClassArgument() { public ClassArgument() {
} }


/**
* Set the name attribute.
* @param name the name attribute.
*/
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }


/**
* Get the name attribute.
* @return the name attribute.
*/
public String getName() { public String getName() {
return name; return name;
} }
@@ -140,6 +155,7 @@ public class Javah extends Task {
/** /**
* Set the destination directory into which the Java source * Set the destination directory into which the Java source
* files should be compiled. * files should be compiled.
* @param destDir the destination directory.
*/ */
public void setDestdir(File destDir) { public void setDestdir(File destDir) {
this.destDir = destDir; this.destDir = destDir;
@@ -156,6 +172,7 @@ public class Javah extends Task {


/** /**
* the classpath to use. * the classpath to use.
* @param src the classpath.
*/ */
public void setClasspath(Path src) { public void setClasspath(Path src) {
if (classpath == null) { if (classpath == null) {
@@ -167,6 +184,7 @@ public class Javah extends Task {


/** /**
* Path to use for classpath. * Path to use for classpath.
* @return a path to be configured.
*/ */
public Path createClasspath() { public Path createClasspath() {
if (classpath == null) { if (classpath == null) {
@@ -177,7 +195,8 @@ public class Javah extends Task {


/** /**
* Adds a reference to a classpath defined elsewhere. * Adds a reference to a classpath defined elsewhere.
* @todo this needs to be documented in the HTML docs
* @param r a reference to a classpath.
* @todo this needs to be documented in the HTML docs.
*/ */
public void setClasspathRef(Reference r) { public void setClasspathRef(Reference r) {
createClasspath().setRefid(r); createClasspath().setRefid(r);
@@ -194,6 +213,7 @@ public class Javah extends Task {


/** /**
* location of bootstrap class files. * location of bootstrap class files.
* @param src the bootstrap classpath.
*/ */
public void setBootclasspath(Path src) { public void setBootclasspath(Path src) {
if (bootclasspath == null) { if (bootclasspath == null) {
@@ -205,6 +225,7 @@ public class Javah extends Task {


/** /**
* Adds path to bootstrap class files. * Adds path to bootstrap class files.
* @return a path to be configured.
*/ */
public Path createBootclasspath() { public Path createBootclasspath() {
if (bootclasspath == null) { if (bootclasspath == null) {
@@ -214,8 +235,9 @@ public class Javah extends Task {
} }


/** /**
* Adds a reference to a classpath defined elsewhere.
* @todo this needs to be documented in the HTML
* To the bootstrap path, this adds a reference to a classpath defined elsewhere.
* @param r a reference to a classpath
* @todo this needs to be documented in the HTML.
*/ */
public void setBootClasspathRef(Reference r) { public void setBootClasspathRef(Reference r) {
createBootclasspath().setRefid(r); createBootclasspath().setRefid(r);
@@ -233,6 +255,7 @@ public class Javah extends Task {
/** /**
* Concatenates the resulting header or source files for all * Concatenates the resulting header or source files for all
* the classes listed into this file. * the classes listed into this file.
* @param outputFile the output file.
*/ */
public void setOutputFile(File outputFile) { public void setOutputFile(File outputFile) {
this.outputFile = outputFile; this.outputFile = outputFile;
@@ -249,6 +272,7 @@ public class Javah extends Task {


/** /**
* If true, output files should always be written (JDK1.2 only). * If true, output files should always be written (JDK1.2 only).
* @param force the value to use.
*/ */
public void setForce(boolean force) { public void setForce(boolean force) {
this.force = force; this.force = force;
@@ -266,7 +290,9 @@ public class Javah extends Task {
/** /**
* If true, specifies that old JDK1.0-style header files should be * If true, specifies that old JDK1.0-style header files should be
* generated. * generated.
* (otherwise output file contain JNI-style native method function prototypes) (JDK1.2 only)
* (otherwise output file contain JNI-style native method function
* prototypes) (JDK1.2 only).
* @param old if true use old 1.0 style header files.
*/ */
public void setOld(boolean old) { public void setOld(boolean old) {
this.old = old; this.old = old;
@@ -283,6 +309,7 @@ public class Javah extends Task {


/** /**
* If true, generate C declarations from the Java object file (used with old). * If true, generate C declarations from the Java object file (used with old).
* @param stubs if true, generated C declarations.
*/ */
public void setStubs(boolean stubs) { public void setStubs(boolean stubs) {
this.stubs = stubs; this.stubs = stubs;
@@ -300,6 +327,7 @@ public class Javah extends Task {
/** /**
* If true, causes Javah to print a message concerning * If true, causes Javah to print a message concerning
* the status of the generated files. * the status of the generated files.
* @param verbose if true, do verbose printing.
*/ */
public void setVerbose(boolean verbose) { public void setVerbose(boolean verbose) {
this.verbose = verbose; this.verbose = verbose;
@@ -316,7 +344,7 @@ public class Javah extends Task {


/** /**
* Choose the implementation for this particular task. * Choose the implementation for this particular task.
* @param impl the name of the implemenation
* @param impl the name of the implemenation.
* @since Ant 1.6.3 * @since Ant 1.6.3
*/ */
public void setImplementation(String impl) { public void setImplementation(String impl) {
@@ -329,7 +357,7 @@ public class Javah extends Task {


/** /**
* Adds an implementation specific command-line argument. * Adds an implementation specific command-line argument.
* @return a ImplementationSpecificArgument to be configured
* @return a ImplementationSpecificArgument to be configured.
* *
* @since Ant 1.6.3 * @since Ant 1.6.3
*/ */
@@ -404,6 +432,7 @@ public class Javah extends Task {
/** /**
* Logs the compilation parameters, adds the files to compile and logs the * Logs the compilation parameters, adds the files to compile and logs the
* &quot;niceSourceList&quot; * &quot;niceSourceList&quot;
* @param cmd the command line to add parameters to.
*/ */
protected void logAndAddFilesToCompile(Commandline cmd) { protected void logAndAddFilesToCompile(Commandline cmd) {
log("Compilation " + cmd.describeArguments(), log("Compilation " + cmd.describeArguments(),


+ 45
- 3
src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2001-2004 The Apache Software Foundation
* Copyright 2001-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -101,9 +101,18 @@ public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware
/** factory attributes */ /** factory attributes */
private Vector attributes = new Vector(); private Vector attributes = new Vector();


/**
* Constructor for TraXLiaison.
* @throws Exception never
*/
public TraXLiaison() throws Exception { public TraXLiaison() throws Exception {
} }


/**
* Set the stylesheet file.
* @param stylesheet a <code>File</code> value
* @throws Exception on error
*/
public void setStylesheet(File stylesheet) throws Exception { public void setStylesheet(File stylesheet) throws Exception {
if (this.stylesheet != null) { if (this.stylesheet != null) {
// resetting the stylesheet - reset transformer // resetting the stylesheet - reset transformer
@@ -118,6 +127,12 @@ public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware
this.stylesheet = stylesheet; this.stylesheet = stylesheet;
} }


/**
* Transform an input file.
* @param infile the file to transform
* @param outfile the result file
* @throws Exception on error
*/
public void transform(File infile, File outfile) throws Exception { public void transform(File infile, File outfile) throws Exception {
if (transformer == null) { if (transformer == null) {
createTransformer(); createTransformer();
@@ -316,36 +331,61 @@ public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware
outputProperties.addElement(pair); outputProperties.addElement(pair);
} }


/** Set the class to resolve entities during the transformation
/**
* Set the class to resolve entities during the transformation.
* @param aResolver the resolver class.
*/ */
public void setEntityResolver(EntityResolver aResolver) { public void setEntityResolver(EntityResolver aResolver) {
entityResolver = aResolver; entityResolver = aResolver;
} }


/** Set the class to resolve URIs during the transformation
/**
* Set the class to resolve URIs during the transformation
* @param aResolver a <code>EntityResolver</code> value
*/ */
public void setURIResolver(URIResolver aResolver) { public void setURIResolver(URIResolver aResolver) {
uriResolver = aResolver; uriResolver = aResolver;
} }


/**
* Add a parameter.
* @param name the name of the parameter
* @param value the value of the parameter
*/
public void addParam(String name, String value) { public void addParam(String name, String value) {
final String[] pair = new String[]{name, value}; final String[] pair = new String[]{name, value};
params.addElement(pair); params.addElement(pair);
} }


/**
* Set a logger.
* @param l a logger.
*/
public void setLogger(XSLTLogger l) { public void setLogger(XSLTLogger l) {
logger = l; logger = l;
} }


/**
* Log an error.
* @param e the exception to log.
*/
public void error(TransformerException e) { public void error(TransformerException e) {
logError(e, "Error"); logError(e, "Error");
} }


/**
* Log a fatal error.
* @param e the exception to log.
*/
public void fatalError(TransformerException e) { public void fatalError(TransformerException e) {
logError(e, "Fatal Error"); logError(e, "Fatal Error");
throw new BuildException("Fatal error during transformation", e); throw new BuildException("Fatal error during transformation", e);
} }


/**
* Log a warning.
* @param e the exception to log.
*/
public void warning(TransformerException e) { public void warning(TransformerException e) {
logError(e, "Warning"); logError(e, "Warning");
} }
@@ -388,6 +428,8 @@ public class TraXLiaison implements XSLTLiaison2, ErrorListener, XSLTLoggerAware


// kept for backwards compatibility // kept for backwards compatibility
/** /**
* @param file the filename to use for the systemid
* @return the systemid
* @deprecated use org.apache.tools.ant.util.JAXPUtils#getSystemId instead * @deprecated use org.apache.tools.ant.util.JAXPUtils#getSystemId instead
*/ */
protected String getSystemId(File file) { protected String getSystemId(File file) {


+ 21
- 1
src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2000-2002,2004 The Apache Software Foundation
* Copyright 2000-2002,2004-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -37,14 +37,29 @@ public class XalanLiaison implements XSLTLiaison {
protected XSLTProcessor processor; protected XSLTProcessor processor;
protected File stylesheet; protected File stylesheet;


/**
* Constructor for XalanLiaison.
* @throws Exception on error
*/
public XalanLiaison() throws Exception { public XalanLiaison() throws Exception {
processor = XSLTProcessorFactory.getProcessor(); processor = XSLTProcessorFactory.getProcessor();
} }


/**
* Set the style sheet to use.
* @param stylesheet the style sheet file to use
* @throws Exception on error
*/
public void setStylesheet(File stylesheet) throws Exception { public void setStylesheet(File stylesheet) throws Exception {
this.stylesheet = stylesheet; this.stylesheet = stylesheet;
} }


/**
* Carry out the transformation.
* @param infile the input file
* @param outfile the output file
* @throws Exception on error
*/
public void transform(File infile, File outfile) throws Exception { public void transform(File infile, File outfile) throws Exception {
FileInputStream fis = null; FileInputStream fis = null;
FileOutputStream fos = null; FileOutputStream fos = null;
@@ -89,6 +104,11 @@ public class XalanLiaison implements XSLTLiaison {
} }
} }


/**
* Add a parameter.
* @param name the name of the parameter
* @param value the value of the parameter
*/
public void addParam(String name, String value) { public void addParam(String name, String value) {
processor.setStylesheetParam(name, value); processor.setStylesheetParam(name, value);
} }


Loading…
Cancel
Save