Skip to content

Commit

Permalink
Added missing and cleaned up JavaDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ethauvin committed Oct 30, 2024
1 parent 97edc07 commit daadd0b
Show file tree
Hide file tree
Showing 33 changed files with 206 additions and 41 deletions.
1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ This project provides a collection of useful template renderers.
| [rife.render.Capitalize](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Capitalize) | Capitalizes a template value |
| [rife.render.Lowercase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Lowercase) | Converts a template value to lowercase |
| [rife.render.Rot13](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Rot13) | Translates a template value to/from ROT13 |
| [rife.render.SwapCase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.SwapCase) | Swap case of a template value |
| [rife.render.SwapCase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.SwapCase) | Swaps case of a template value |
| [rife.render.Trim](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Trim) | Removes leading and trailing whitespace from a template value |
| [rife.render.Uncapitalize](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Uncapitalize) | Uncapitalizes a template value |
| [rife.render.Uppercase](https://github.com/rife2/rife2-template-renderers/wiki/rife.render.Uppercase) | Converts a template value to uppercase |
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/rife/render/Abbreviate.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import rife.template.ValueRenderer;

/**
* <p>Abbreviate a template value with ellipses.</p>
* <p>Abbreviates a template value with ellipses.</p>
*
* <p>Usage:</p>
*
Expand All @@ -36,7 +36,18 @@
*/
public class Abbreviate implements ValueRenderer {
/**
* {@inheritDoc}
* <p>Returns the template value abbreviated with ellipses.</p>
*
* <p>Two parameters can be specified:</p>
* <ul>
* <li><code>mark</code>: the string that will be used to abbreviate the value. Default is <code>...</code></li>
* <li><code>max</code>: the maximum number of characters to render. Default is <code>-1</code> (no abbreviation).</li>
* </ul>
*
* @param template the template that contains the value
* @param valueId the id of the value to render
* @param differentiator a generic string that can be used to differentiate the rendering
* @return the abbreviated value, or the original value if no abbreviation is necessary
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/BeatTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
*/
public class BeatTime implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the current time in Swatch Internet (.beat) Time format.
*
* @param template the template instance
* @param valueId the value id
* @param differentiator the differentiator
* @return the rendered value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/Capitalize.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@
*/
public class Capitalize implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value by capitalizing it.
*
* @param template the template containing the value to be rendered
* @param valueId the identifier of the value to render
* @param differentiator a string used to differentiate the rendering
* @return the capitalized and encoded value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/rife/render/DateIso.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.time.ZonedDateTime;

/**
* <p>Return the current date in ISO 8601 format.</p>
* <p>Renders the current date in ISO 8601 format.</p>
*
* <p>Usage:</p>
*
Expand All @@ -38,7 +38,12 @@
*/
public class DateIso implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the current date in ISO 8601 format, encoded according to the template's encoding rules.
*
* @param template the template that is currently being rendered
* @param valueId the value id that triggers the rendering of this value renderer
* @param differentiator a differentiator that may be used to differentiate the rendering of this value renderer
* @return the current date in ISO 8601 format, encoded according to the template's encoding rules
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
12 changes: 10 additions & 2 deletions src/main/java/rife/render/DateTimeIso.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.time.ZonedDateTime;

/**
* <p>Return the current date and time in ISO 8601 format.</p>
* <p>Renders the current date and time in ISO 8601 format.</p>
*
* <p>Usage:</p>
*
Expand All @@ -39,7 +39,15 @@
*/
public class DateTimeIso implements ValueRenderer {
/**
* {@inheritDoc}
* Renders the current date and time in ISO 8601 format.
*
* <p>Additionally, it allows specifying a time zone through the template's default value properties with the key
* {@code tz}. If no time zone is specified, the system default time zone is used.</p>
*
* @param template the template that is currently being rendered
* @param valueId the id of the value to be rendered
* @param differentiator a differentiator that may be used to differentiate the rendering of this value renderer
* @return the current date and time in ISO 8601 format
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/rife/render/DateTimeRfc2822.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.time.ZonedDateTime;

/**
* <p>Return the current date and time in RFC 2822 format.</p>
* <p>Renders the current date and time in RFC 2822 format.</p>
*
* <p>Usage:</p>
*
Expand All @@ -38,7 +38,12 @@
*/
public class DateTimeRfc2822 implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the current date and time in RFC 2822 format.
*
* @param template the template instance
* @param valueId the value id
* @param differentiator the differentiator
* @return the current date and time in RFC 2822 format
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/EncodeBase64.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@
*/
public class EncodeBase64 implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value encoded to Base64.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the Base64-encoded value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/EncodeHtml.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
*/
public class EncodeHtml implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value encoded to HTML.
*
* @param template the template containing the value to be rendered
* @param valueId the identifier of the value to render
* @param differentiator a string used to differentiate the rendering
* @return the HTML-encoded value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/EncodeHtmlEntities.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
*/
public class EncodeHtmlEntities implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value encoded to HTML decimal entities.
*
* @param template the template instance
* @param valueId the value id
* @param differentiator the differentiator
* @return the encoded value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/EncodeJs.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
*/
public class EncodeJs implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value encoded to JavaScript/ECMAScript.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the JavaScript/ECMAScript-encoded value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/EncodeJson.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
*/
public class EncodeJson implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value encoded to JSON.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the JSON-encoded value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/EncodeUnicode.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
*/
public class EncodeUnicode implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value encoded to Unicode escape codes.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the Unicode escape codes-encoded value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/EncodeUrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
*/
public class EncodeUrl implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value encoded to URL.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the URL-encoded value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/EncodeXml.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
*/
public class EncodeXml implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value encoded to XML.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the XML-encoded value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/FormatCreditCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
*/
public class FormatCreditCard implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the last 4 digits of the template credit number value.
*
* @param template the {@link Template}
* @param valueId the value id
* @param differentiator the differentiator
* @return the formatted value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/Lowercase.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@
*/
public class Lowercase implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value converted to lowercase.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the lowercase value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
24 changes: 23 additions & 1 deletion src/main/java/rife/render/Mask.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,30 @@
* @since 1.0
*/
public class Mask implements ValueRenderer {

/**
* {@inheritDoc}
* <p>Renders a template value with characters of the value masked using the specified mask.</p>
*
* <p>The mask is specified as a template default value with the following syntax:</p>
*
* <pre>
* mask=&lt;mask&gt;[,unmasked=&lt;unmasked&gt;][,fromStart=&lt;fromStart&gt;]
* </pre>
*
* <p>Where:</p>
*
* <ul>
* <li><var>mask</var> is the character to use for masking, defaulting to <code>*</code></li>
* <li><var>unmasked</var> is the number of characters at the beginning of the value that should be left unmasked,
* defaulting to <code>0</code></li>
* <li><var>fromStart</var> is a boolean indicating whether the <var>unmasked</var> value should be counted from
* the start of the value, defaulting to <code>false</code></li>
* </ul>
*
* @param template the template to render the value in
* @param valueId the ID of the value to render
* @param differentiator the differentiator of the value to render
* @return the rendered value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/Normalize.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
*/
public class Normalize implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value normalized for inclusion in a URL path.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the normalized value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/QrCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
*/
public class QrCode implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value encoded as an SVG QR Code.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the SVG QR Code
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/rife/render/RenderUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public final class RenderUtils {
DateTimeFormatter.ofPattern("EEE, d MMM yyyy HH:mm:ss zzz").withLocale(Localization.getLocale());
private static final String DEFAULT_USER_AGENT =
"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0";
private final static Logger LOGGER = Logger.getLogger(RenderUtils.class.getName());
private static final Logger LOGGER = Logger.getLogger(RenderUtils.class.getName());

private RenderUtils() {
// no-op
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/Rot13.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
*/
public class Rot13 implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value translated to/from ROT13.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the ROT13 value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/rife/render/ShortenUrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@
*/
public class ShortenUrl implements ValueRenderer {
/**
* {@inheritDoc}
* Returns the template value shortened using <a href="https://is.gd/">is.gid</a>.
*
* @param template the template that contains the value
* @param valueId the id of the value
* @param differentiator the differentiator to use
* @return the template shortened value
*/
@Override
public String render(Template template, String valueId, String differentiator) {
Expand Down
Loading

0 comments on commit daadd0b

Please sign in to comment.