Skip to content

Commit

Permalink
Cleaned up JavaDocs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahenson committed Jun 16, 2016
1 parent 697a069 commit cc5f1e3
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

/**
* The
* <code>ConfigurationReader<code> class is used to initialize Flatworm with an XML configuration file which
* {@code ConfigurationReader} class is used to initialize Flatworm with an XML configuration file which
* describes the format and conversion options to be applied to the input file to produce output beans.
*/
public class ConfigurationReader {
Expand Down
29 changes: 14 additions & 15 deletions flatworm-core/src/main/java/com/blackbear/flatworm/FileCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ public class FileCreator {
private OutputStream outputStream;

/**
* Constructor for FileCreator<br>
* Constructor for FileCreator.
*
* @param config Full path to the FlatWorm XML configuration file
* @param file Full path to output file
* @throws FlatwormCreatorException - wraps FlatwormConfigurationValueException & FlatwormUnsetFieldValueException (to reduce number of
* exceptions clients have to be aware of)
* @param config Full path to the FlatWorm XML configuration file.
* @param file Full path to output file.
* @throws FlatwormCreatorException - wraps FlatwormConfigurationValueException and FlatwormUnsetFieldValueException (to reduce number
* of exceptions clients have to be aware of).
*/
public FileCreator(String config, String file) throws FlatwormCreatorException {
this.file = file;
Expand Down Expand Up @@ -110,18 +110,17 @@ private void loadConfigurationFile(String config) throws FlatwormCreatorExceptio
}

/**
* Open the newfile for writing<br>
* Open the file for writing.
*
* @throws FileNotFoundException should the file specified not exist.
* @throws UnsupportedEncodingException should the format of the file not be supported.
*/
public void open() throws FlatwormCreatorException, UnsupportedEncodingException {
public void open() throws FileNotFoundException, UnsupportedEncodingException {
// Setup buffered writer
try {
if (file != null) {
outputStream = new FileOutputStream(file);
}
bufOut = new BufferedWriter(new OutputStreamWriter(outputStream, ff.getEncoding()));
} catch (FileNotFoundException ex) {
throw new FlatwormCreatorException(ex.getMessage(), ex);
if (file != null) {
outputStream = new FileOutputStream(file);
}
bufOut = new BufferedWriter(new OutputStreamWriter(outputStream, ff.getEncoding()));
}

/**
Expand Down Expand Up @@ -154,7 +153,7 @@ public void close() throws IOException {

/**
* Write information to the output file. Make sure you have called the setBean() method with the needed beans before calling this
* method.<br>
* method.
*
* @param recordName The name specified in your flatworm configuration file for this record
* @throws IOException - If the file system has a problem with you writing information to the recently opened file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,15 @@ public ConversionHelper getConversionHelper() {

/**
* When called with a {@code BufferedReader}, reads sufficient lines to parse a record, and returns the beans created.
*
* @param in The stream to read from
* @return The created beans in a MatchedRecord object
* @throws FlatwormInvalidRecordException TODO This needs to be simplified.
* @throws FlatwormInputLineLengthException TODO This needs to be simplified.
* @throws FlatwormConversionException TODO This needs to be simplified.
* @throws FlatwormUnsetFieldValueException TODO This needs to be simplified.
* @throws FlatwormCreatorException TODO This needs to be simplified.
* @throws FlatwormParserException TODO This needs to be simplified.
* @throws IOException TODO This needs to be simplified.
*/
public MatchedRecord nextRecord(BufferedReader in) throws FlatwormInvalidRecordException,
FlatwormInputLineLengthException, FlatwormConversionException,
Expand Down
19 changes: 10 additions & 9 deletions flatworm-core/src/main/java/com/blackbear/flatworm/FileParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class FileParser {
*
* @param config full path to the FlatWorm XML configuration file
* @param file full path to input file
* @throws FlatwormParserException - wraps FlatwormConfigurationValueException & FlatwormUnsetFieldValueException (to reduce number of
* @throws FlatwormParserException - wraps FlatwormConfigurationValueException and FlatwormUnsetFieldValueException (to reduce number of
* exceptions clients have to be aware of)
*/
public FileParser(String config, String file) throws FlatwormParserException {
Expand All @@ -74,10 +74,11 @@ public FileParser(String config, String file) throws FlatwormParserException {
}

/**
* Provide a callback object that doesn't require reflection to be invoked. The <code>MatchedRecord</code> will be passed back to the
* Provide a callback object that doesn't require reflection to be invoked. The {@code MatchedRecord} will be passed back to the
* callback. Add a callback for each record type specified in the configuration file.
*
* @since 2.0
* @param recordName The name of the record.
* @param callback The {@link RecordCallback} instance to register.
*/
public void addRecordCallback(String recordName, RecordCallback callback) {
recordCallbacks.put(recordName, callback);
Expand All @@ -88,14 +89,14 @@ public void addRecordCallback(String recordName, RecordCallback callback) {
* be passed to the callback, along with the input line that caused the exception. Should only be invoked once as any subsequent
* invocations will replace the previous callback.
*
* @since 2.0
* @param callback The {@link ExceptionCallback} instance to register.
*/
public void setExceptionCallback(ExceptionCallback callback) {
exceptionCallback = callback;
}

/**
* Open the buffered reader for the input file<br>
* Open the buffered reader for the input file.
*
* @throws IOException should the {@link InputStream} fail to properly open.
*/
Expand All @@ -106,7 +107,7 @@ public void open() throws IOException {
}

/**
* Close the input file<br>
* Close the input file.
*
* @throws IOException - Should the file system choose to complain about closing an existing file opened for reading.
*/
Expand All @@ -119,7 +120,7 @@ public void close() throws IOException {
/**
* Read the entire input file. This method will call your handler methods, if defined, to handle Records it parses. <br> <br>
* <b>NOTE:</b> All exceptions are consumed and passed to the exception handler method you defined (The offending line is provided just
* in case you want to do something with it.<br>
* in case you want to do something with it.
*/
public void read() {

Expand All @@ -145,13 +146,13 @@ public void read() {
}

/**
* Encapsulated details about calling client's handler methods (for exceptions too)
* Encapsulated details about calling client's handler methods (for exceptions too).
*
* @param callback The Callback object to be invoked
* @param arg1 first argument for callback - used for record handlers and exceptions
* @param arg2 second argument for callback - used for only for exceptions. Contains a string that contains the offending line from
* the input file <br> <br> <b>NOTE:</b> All exceptions are consumed and passed to the exception handler method you
* defined (The offending line is provided just in case you want to do something with it.<br>
* defined (The offending line is provided just in case you want to do something with it.
*/
private void doCallback(Callback callback, Object arg1, Object arg2) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
import lombok.extern.slf4j.Slf4j;

/**
* <p>{@code CoreConverters} contains methods to convert the most commonly encountered text types to native Java types. It can be used as
* the {@code class} parameter in a Flatworm {@code converter} tag, with one of the public methods listed below as the {@code method}
* parameter. <p/> All converters (included the ones listed here and any supplied by the user) should expect to accept and handle the
* following {@code conversion-option}s: <p/> <dl> <dt>{@code justify}</dt> <dd>Defines the justification rule used to strip/add pad
* characters to this field. Used in conjunction with the {@code pad-character} option. Valid values are: <ul> <li>{@code left} to strip the
* right hand side of the field of pad chars</li> <li>{@code right} to strip the left hand side of the field of pad chars</li> <li>{@code
* both} to strip both end of the field of pad chars</li> </ul> The default if no value is specified is {@code both}</dd> <dt>{@code
* pad-character}</dt> <dd>Defines the character to be used in conjunction with the {@code justify} option when removing or adding pad
* characters from a field. The default value is the space character.</dd> <dt>{@code default-value}</dt> <dd>Defines the default value to
* be used if the field is empty after being stripped of pad characters.</dd> </dl>
* {@code CoreConverters} contains methods to convert the most commonly encountered text types to native Java types. It can be used as the
* {@code class} parameter in a Flatworm {@code converter} tag, with one of the public methods listed below as the {@code method} parameter.
* All converters (included the ones listed here and any supplied by the user) should expect to accept and handle the following {@code
* conversion-option}s: <dl> <dt>{@code justify}</dt> <dd>Defines the justification rule used to strip/add pad characters to this field.
* Used in conjunction with the {@code pad-character} option. Valid values are: <ul> <li>{@code left} to strip the right hand side of the
* field of pad chars</li> <li>{@code right} to strip the left hand side of the field of pad chars</li> <li>{@code both} to strip both end
* of the field of pad chars</li> </ul> The default if no value is specified is {@code both}</dd> <dt>{@code pad-character}</dt> <dd>Defines
* the character to be used in conjunction with the {@code justify} option when removing or adding pad characters from a field. The default
* value is the space character.</dd> <dt>{@code default-value}</dt> <dd>Defines the default value to be used if the field is empty after
* being stripped of pad characters.</dd> </dl>
*
* @author James M. Turner
* @version $Id: CoreConverters.java,v 1.8 2009/12/07 00:50:53 dderry Exp $
Expand All @@ -61,7 +61,7 @@ public String convertChar(String str, Map<String, ConversionOption> options) {
}

/**
* Object->String conversion function.
* Object to String conversion function.
*
* @param obj source object
* @param options The conversion-option values for the field
Expand All @@ -72,9 +72,9 @@ public String convertChar(Object obj, Map<String, ConversionOption> options) {
}

/**
* <p>Conversion function for {@code Date}, returns the source string with padding removed if requested, converted into a date. <p/> In
* addition to the standard conversion options, dates also support the following: <p/> <dl> <dt>{@code format}</dt> <dd>A date format
* string in {@code SimpleDateFormat} syntax that defines the format to expect, default is yyyy-MM-dd.</dd> </dl>
* Conversion function for {@code Date}, returns the source string with padding removed if requested, converted into a date. In
* addition to the standard conversion options, dates also support the following: <dl> <dt>{@code format}</dt> <dd>A date format string
* in {@code SimpleDateFormat} syntax that defines the format to expect, default is yyyy-MM-dd.</dd> </dl>
*
* @param str The source string
* @param options The conversion-option values for the field
Expand All @@ -101,7 +101,7 @@ public Date convertDate(String str, Map<String, ConversionOption> options)
}

/**
* Date->String conversion function.
* Date to String conversion function.
*
* @param obj source object of type {@link Date}.
* @param options The conversion-option values for the field
Expand All @@ -119,13 +119,13 @@ public String convertDate(Object obj, Map<String, ConversionOption> options) {
}

/**
* <p> Conversion function for {@code Double}, returns the source string with padding removed if requested, converted into a double.
* <p/>
* Conversion function for {@code Double}, returns the source string with padding removed if requested, converted into a double.
*
* <p> In addition to the standard conversion options, doubles also support the following: <p/> <dl> <dt>{@code decimal-implied}</dt>
* <dd>If set to {@code true}, the decimal point is positionally implied rather than explicitly included. If set, {@code decimal-places}
* is required.</dd> <dt>{@code decimal-places}</dt> <dd>The number of digits in the string which are to the right of the decimal point,
* if {@code decimal-implied} is set.</dd> </dl>
*
* In addition to the standard conversion options, doubles also support the following: <dl> <dt>{@code decimal-implied}</dt> <dd>If set
* to {@code true}, the decimal point is positionally implied rather than explicitly included. If set, {@code decimal-places} is
* required.</dd> <dt>{@code decimal-places}</dt> <dd>The number of digits in the string which are to the right of the decimal point, if
* {@code decimal-implied} is set.</dd> </dl>
*
* @param str The source string
* @param options The conversion-option values for the field
Expand Down Expand Up @@ -257,8 +257,8 @@ public String convertLong(Object obj, Map<String, ConversionOption> options) {
}

/**
* <p> Conversion function for {@code BigDecimal}, returns the source string with padding removed if requested, converted into a big
* decimal. <p/> <p> In addition to the standard conversion options, big decimals also support the following: <p/> <dl> <dt>{@code
* Conversion function for {@code BigDecimal}, returns the source string with padding removed if requested, converted into a big
* decimal. In addition to the standard conversion options, big decimals also support the following: <dl> <dt>{@code
* decimal-implied}</dt> <dd>If set to {@code true}, the decimal point is positionally implied rather than explicitly included. If set,
* {@code decimal-places} is required.</dd> <dt>{@code decimal-places}</dt> <dd>The number of digits in the string which are to the
* right of the decimal point, if {@code decimal-implied} is set.</dd> </dl>
Expand Down
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@
</developers>

<properties>
<!-- Compiler Properties -->
<!-- Plugin Properties -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.source.plugin.version>3.0.0</maven.source.plugin.version>
<maven.javadoc.plugin.version>2.10.4</maven.javadoc.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Dependency Properties -->
<commons.beanutils.version>1.9.2</commons.beanutils.version>
<commons.collections.version>3.2.1</commons.collections.version>
<commons.lang.version>2.6</commons.lang.version>
Expand Down Expand Up @@ -181,6 +185,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven.source.plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -193,6 +198,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven.javadoc.plugin.version}</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down

0 comments on commit cc5f1e3

Please sign in to comment.