Improved source documentation.
Some PMD optimization.
This commit is contained in:
parent
1b59f8e5dc
commit
f5f9d5cbda
8 changed files with 34 additions and 25 deletions
|
@ -38,7 +38,8 @@ import java.util.ResourceBundle;
|
|||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* The <code>Reasons</code> class.
|
||||
* Populates the {@link #REASON_PHRASES reason phrases} map from {@link #BUNDLE_BASENAME bundle properties}, and
|
||||
* implements accessor methods.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-02
|
||||
|
@ -57,7 +58,7 @@ public class Reasons
|
|||
private static final Map<String, String> REASON_PHRASES = new TreeMap<String, String>();
|
||||
|
||||
/**
|
||||
* Gets the reason phrase for the specified status code.
|
||||
* Returns the reason phrase for the specified status code.
|
||||
*
|
||||
* @param statusCode The status code.
|
||||
*
|
||||
|
@ -69,7 +70,7 @@ public class Reasons
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the reason phrase for the specified status code.
|
||||
* Returns the reason phrase for the specified status code.
|
||||
*
|
||||
* @param statusCode The status code.
|
||||
*
|
||||
|
@ -81,7 +82,7 @@ public class Reasons
|
|||
}
|
||||
|
||||
/**
|
||||
* Outputs the status codes and reason phrases.
|
||||
* Prints the status codes and reason phrases.
|
||||
*
|
||||
* @param args The command line arguments.
|
||||
*/
|
||||
|
|
|
@ -49,7 +49,7 @@ public final class Utils
|
|||
/**
|
||||
* Disables the default constructor.
|
||||
*
|
||||
* @throws UnsupportedOperationException if an error occurred. if the constructor is called.
|
||||
* @throws UnsupportedOperationException If the constructor is called.
|
||||
*/
|
||||
private Utils()
|
||||
throws UnsupportedOperationException
|
||||
|
@ -58,14 +58,14 @@ public final class Utils
|
|||
}
|
||||
|
||||
/**
|
||||
* Writes a string value.
|
||||
* Writes a string value to the specified writer. The default value is used when the actual value is null.
|
||||
*
|
||||
* @param out The writer to output the value to.
|
||||
* @param value The string value.
|
||||
* @param defaultValue The default value.
|
||||
* @param xml The xml flag.
|
||||
* @param xml The {@link #escapeXml(String) xml} flag.
|
||||
*/
|
||||
public static void outWrite(Writer out, String value, String defaultValue, boolean xml)
|
||||
public static void outWrite(final Writer out, final String value, final String defaultValue, final boolean xml)
|
||||
throws IOException
|
||||
{
|
||||
if (xml)
|
||||
|
@ -93,13 +93,14 @@ public final class Utils
|
|||
}
|
||||
|
||||
/**
|
||||
* Escapes a string value.
|
||||
* Converts <code><</code>, <code>></code>, <code>&</code>, <code>'</code>, <code>"</code>
|
||||
* to their corresponding entity codes.
|
||||
*
|
||||
* @param value The string value to escape.
|
||||
* @param value The string value to convert.
|
||||
*
|
||||
* @return The escaped string value.
|
||||
* @return The converted string value.
|
||||
*/
|
||||
public static String escapeXml(String value)
|
||||
public static String escapeXml(final String value)
|
||||
{
|
||||
final StringBuilder escaped = new StringBuilder();
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ import javax.servlet.jsp.PageContext;
|
|||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* The <code>CauseTag</code> class.
|
||||
* The <code><hs:cause></code> tag returns the cause (if any) for the current HTTP Status Error Code.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-03
|
||||
|
|
|
@ -40,7 +40,7 @@ import javax.servlet.jsp.tagext.SimpleTagSupport;
|
|||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* The <code>CodeTag</code> class.
|
||||
* The <code><hs:code></code> tag returns the HTTP Status Error Code.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-03
|
||||
|
|
|
@ -42,7 +42,8 @@ import javax.servlet.jsp.PageContext;
|
|||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* The <code>ReasonTag</code> class.
|
||||
* The <code><hs:reason></code> tag returns the Reason Phrase for the current (or specified) HTTP Status Error
|
||||
* Code.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-02
|
||||
|
@ -85,7 +86,7 @@ public class ReasonTag extends XmlSupport
|
|||
* @param statusCode The status code.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setCode(int statusCode)
|
||||
public void setCode(final int statusCode)
|
||||
{
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ package net.thauvin.erik.httpstatus.taglibs;
|
|||
import javax.servlet.jsp.tagext.SimpleTagSupport;
|
||||
|
||||
/**
|
||||
* The <code>XmlSupport</code> class.
|
||||
* Adds support for the <code>default</code> and <code>escapeXml</code> tag attributes.
|
||||
*
|
||||
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
|
||||
* @created 2015-12-03
|
||||
|
@ -44,8 +44,14 @@ import javax.servlet.jsp.tagext.SimpleTagSupport;
|
|||
*/
|
||||
public abstract class XmlSupport extends SimpleTagSupport
|
||||
{
|
||||
/**
|
||||
* Default value string.
|
||||
*/
|
||||
protected String defaultValue;
|
||||
|
||||
/**
|
||||
* Escape XML flag.
|
||||
*/
|
||||
protected boolean escapeXml = true;
|
||||
|
||||
/**
|
||||
|
@ -54,18 +60,18 @@ public abstract class XmlSupport extends SimpleTagSupport
|
|||
* @param defaultValue The default value.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setDefault(String defaultValue)
|
||||
public void setDefault(final String defaultValue)
|
||||
{
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the escapeXMl flag.
|
||||
* Sets the {@link net.thauvin.erik.httpstatus.Utils#escapeXml(String) xml} flag.
|
||||
*
|
||||
* @param escapeXml <code>true</code> or <code>false</code>
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public void setEscapeXml(boolean escapeXml)
|
||||
public void setEscapeXml(final boolean escapeXml)
|
||||
{
|
||||
this.escapeXml = escapeXml;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
<tag>
|
||||
<description>
|
||||
Outputs the HTTP Status Error Code.
|
||||
Returns the HTTP Status Error Code.
|
||||
</description>
|
||||
<name>code</name>
|
||||
<tag-class>net.thauvin.erik.httpstatus.taglibs.CodeTag</tag-class>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue