Skip to content

Commit

Permalink
Use Javadoc @code and @link
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jul 29, 2024
1 parent a312024 commit 4a87127
Show file tree
Hide file tree
Showing 77 changed files with 995 additions and 984 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/apache/commons/validator/Arg.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@
package org.apache.commons.validator;

import java.io.Serializable;
import java.text.MessageFormat;

/**
* <p>
* A default argument or an argument for a
* specific validator definition (ex: required)
* can be stored to pass into a message as parameters. This can be used in a
* pluggable validator for constructing locale
* sensitive messages by using <code>java.text.MessageFormat</code>
* sensitive messages by using {@link MessageFormat}
* or an equivalent class. The resource field can be
* used to determine if the value stored in the argument
* is a value to be retrieved from a locale sensitive
* message retrieval system like <code>java.util.PropertyResourceBundle</code>.
* message retrieval system like {@code java.util.PropertyResourceBundle}.
* The resource field defaults to 'true'.
* </p>
* <p>Instances of this class are configured with an &lt;arg&gt; xml element.</p>
Expand All @@ -39,7 +40,7 @@ public class Arg implements Cloneable, Serializable {
private static final long serialVersionUID = -8922606779669839294L;

/**
* The resource bundle name that this Arg's <code>key</code> should be
* The resource bundle name that this Arg's {@code key} should be
* resolved in (optional).
* @since 1.1
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
* </p>
*
* <pre>
* <code>CreditCardValidator ccv = new CreditCardValidator(CreditCardValidator.AMEX + CreditCardValidator.VISA);</code>
* {@code CreditCardValidator ccv = new CreditCardValidator(CreditCardValidator.AMEX + CreditCardValidator.VISA);}
* </pre>
*
* <p>
* configures the validator to only pass American Express and Visa cards.
* If a card type is not directly supported by this class, you can implement
* the CreditCardType interface and pass an instance into the
* <code>addAllowedCardType</code> method.
* {@code addAllowedCardType} method.
* </p>
*
* <p>
Expand Down Expand Up @@ -77,7 +77,7 @@ public interface CreditCardType {
* Returns true if the card number matches this type of credit
* card. Note that this method is <strong>not</strong> responsible
* for analyzing the general form of the card number because
* <code>CreditCardValidator</code> performs those checks before
* {@code CreditCardValidator} performs those checks before
* calling this method. It is generally only required to valid the
* length and prefix of the number to determine if it's the correct
* type.
Expand Down Expand Up @@ -126,11 +126,11 @@ public boolean matches(final String card) {
* you want only custom card types to validate so you turn off the
* default cards with this option.
* <pre>
* <code>
* {@code
* CreditCardValidator v = new CreditCardValidator(CreditCardValidator.NONE);
* v.addAllowedCardType(customType);
* v.isValid(aCardNumber);
* </code>
* }
* </pre>
* @since 1.1.2
*/
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/apache/commons/validator/DateValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ protected DateValidator() {
}

/**
* <p>Checks if the field is a valid date. The <code>Locale</code> is
* used with <code>java.text.DateFormat</code>. The setLenient method
* <p>Checks if the field is a valid date. The {@link Locale} is
* used with {@link DateFormat}. The setLenient method
* is set to {@code false} for all.</p>
*
* @param value The value validation is being performed on.
Expand Down Expand Up @@ -93,13 +93,13 @@ public boolean isValid(final String value, final Locale locale) {

/**
* <p>Checks if the field is a valid date. The pattern is used with
* <code>java.text.SimpleDateFormat</code>. If strict is true, then the
* {@link SimpleDateFormat}. If strict is true, then the
* length will be checked so '2/12/1999' will not pass validation with
* the format 'MM/dd/yyyy' because the month isn't two digits.
* The setLenient method is set to {@code false} for all.</p>
*
* @param value The value validation is being performed on.
* @param datePattern The pattern passed to <code>SimpleDateFormat</code>.
* @param datePattern The pattern passed to {@link SimpleDateFormat}.
* @param strict Whether or not to have an exact match of the datePattern.
* @return true if the date is valid.
*/
Expand Down
40 changes: 20 additions & 20 deletions src/main/java/org/apache/commons/validator/Field.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class Field implements Cloneable, Serializable {
private static final long serialVersionUID = -8502647722530192185L;

/**
* This is the value that will be used as a key if the <code>Arg</code>
* This is the value that will be used as a key if the {@code Arg}
* name field has no value.
*/
private static final String DEFAULT_ARG =
Expand Down Expand Up @@ -147,7 +147,7 @@ public class Field implements Cloneable, Serializable {
protected Map<String, Arg>[] args = new Map[0];

/**
* Add an <code>Arg</code> to the replacement argument list.
* Add an {@code Arg} to the replacement argument list.
* @since 1.1
* @param arg Validation message's argument.
*/
Expand Down Expand Up @@ -175,16 +175,16 @@ public void addArg(final Arg arg) {
}

/**
* Add a <code>Msg</code> to the <code>Field</code>.
* Add a {@code Msg} to the {@code Field}.
* @param msg A validation message.
*/
public void addMsg(final Msg msg) {
getMsgMap().put(msg.getName(), msg);
}

/**
* Add a <code>Var</code>, based on the values passed in, to the
* <code>Field</code>.
* Add a {@code Var}, based on the values passed in, to the
* {@code Field}.
* @param name Name of the validation.
* @param value The Argument's value.
* @param jsType The JavaScript type.
Expand All @@ -194,7 +194,7 @@ public void addVar(final String name, final String value, final String jsType) {
}

/**
* Add a <code>Var</code> to the <code>Field</code>.
* Add a {@code Var} to the {@code Field}.
* @param v The Validator Argument.
*/
public void addVar(final Var v) {
Expand Down Expand Up @@ -291,7 +291,7 @@ private void ensureArgsCapacity(final Arg arg) {
}

/**
* Generate correct <code>key</code> value.
* Generate correct {@code key} value.
*/
public void generateKey() {
if (this.isIndexed()) {
Expand All @@ -302,7 +302,7 @@ public void generateKey() {
}

/**
* Gets the default <code>Arg</code> object at the given position.
* Gets the default {@code Arg} object at the given position.
* @param position Validation message argument's position.
* @return The default Arg or null if not found.
* @since 1.1
Expand All @@ -312,7 +312,7 @@ public Arg getArg(final int position) {
}

/**
* Gets the <code>Arg</code> object at the given position. If the key
* Gets the {@code Arg} object at the given position. If the key
* finds a {@code null} value then the default value will be
* retrieved.
* @param key The name the Arg is stored under. If not found, the default
Expand Down Expand Up @@ -355,7 +355,7 @@ public Arg[] getArgs(final String key) {
}

/**
* Gets an unmodifiable <code>List</code> of the dependencies in the same
* Gets an unmodifiable {@code List} of the dependencies in the same
* order they were defined in parameter passed to the setDepends() method.
* @return A list of the Field's dependancies.
*/
Expand All @@ -372,7 +372,7 @@ public String getDepends() {
}

/**
* Gets the position of the <code>Field</code> in the validation list.
* Gets the position of the {@code Field} in the validation list.
* @return The field position.
*/
public int getFieldOrder() {
Expand All @@ -382,7 +382,7 @@ public int getFieldOrder() {
/**
* Gets the indexed property name of the field. This
* is the method name that will return an array or a
* <code>Collection</code> used to retrieve the
* {@link Collection} used to retrieve the
* list and then loop through the list performing the specified
* validations.
* @return The field's indexed List property name.
Expand All @@ -393,7 +393,7 @@ public String getIndexedListProperty() {

/**
* Gets the indexed property name of the field. This
* is the method name that can take an <code>int</code> as
* is the method name that can take an {@code int} as
* a parameter for indexed property value retrieval.
* @return The field's indexed property name.
*/
Expand Down Expand Up @@ -483,8 +483,8 @@ public Msg getMessage(final String key) {
}

/**
* The <code>Field</code>'s messages are returned as an
* unmodifiable <code>Map</code>.
* The {@code Field}'s messages are returned as an
* unmodifiable {@link Map}.
* @since 1.1.4
* @return Map of validation messages for the field.
*/
Expand Down Expand Up @@ -549,8 +549,8 @@ protected Map<String, Var> getVarMap() {
}

/**
* The <code>Field</code>'s variables are returned as an
* unmodifiable <code>Map</code>.
* The {@code Field}'s variables are returned as an
* unmodifiable {@link Map}.
* @return the Map of Variable's for a Field.
*/
public Map<String, Var> getVars() {
Expand Down Expand Up @@ -616,7 +616,7 @@ public boolean isIndexed() {

/**
* Replace constants with values in fields and process the depends field
* to create the dependency <code>Map</code>.
* to create the dependency {@link Map}.
*/
void process(final Map<String, String> globalConstants, final Map<String, String> constants) {
this.hMsgs.setFast(false);
Expand Down Expand Up @@ -663,7 +663,7 @@ void process(final Map<String, String> globalConstants, final Map<String, String
}

/**
* Replace the arg <code>Collection</code> key value with the key/value
* Replace the arg {@link Collection} key value with the key/value
* pairs passed in.
*/
private void processArg(final String key, final String replaceValue) {
Expand Down Expand Up @@ -774,7 +774,7 @@ public void setDepends(final String depends) {
}

/**
* Sets the position of the <code>Field</code> in the validation list.
* Sets the position of the {@code Field} in the validation list.
* @param fieldOrder The field position.
*/
public void setFieldOrder(final int fieldOrder) {
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/org/apache/commons/validator/Form.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
/**
* <p>
* This contains a set of validation rules for a form/JavaBean. The information
* is contained in a list of <code>Field</code> objects. Instances of this class
* is contained in a list of {@code Field} objects. Instances of this class
* are configured with a &lt;form&gt; xml element.
* </p>
* <p>
Expand All @@ -45,14 +45,14 @@ public class Form implements Serializable {
protected String name;

/**
* List of <code>Field</code>s. Used to maintain the order they were added
* in although individual <code>Field</code>s can be retrieved using <code>Map</code>
* of <code>Field</code>s.
* List of {@code Field}s. Used to maintain the order they were added
* in although individual {@code Field}s can be retrieved using {@link Map}
* of {@code Field}s.
*/
protected List<Field> lFields = new ArrayList<>();

/**
* Map of <code>Field</code>s keyed on their property value.
* Map of {@code Field}s keyed on their property value.
*
* @deprecated Subclasses should use getFieldMap() instead.
*/
Expand All @@ -67,13 +67,13 @@ public class Form implements Serializable {
protected String inherit;

/**
* Whether or not the this <code>Form</code> was processed for replacing
* Whether or not the this {@code Form} was processed for replacing
* variables in strings with their values.
*/
private boolean processed;

/**
* Add a <code>Field</code> to the <code>Form</code>.
* Add a {@code Field} to the {@code Form}.
*
* @param f The field
*/
Expand Down Expand Up @@ -127,8 +127,8 @@ protected Map<String, Field> getFieldMap() {
}

/**
* A <code>List</code> of <code>Field</code>s is returned as an unmodifiable
* <code>List</code>.
* A {@code List} of {@code Field}s is returned as an unmodifiable
* {@code List}.
*
* @return The fields value
*/
Expand Down Expand Up @@ -156,7 +156,7 @@ public boolean isExtending() {
}

/**
* Whether or not the this <code>Form</code> was processed for replacing
* Whether or not the this {@code Form} was processed for replacing
* variables in strings with their values.
*
* @return The processed value
Expand All @@ -167,8 +167,8 @@ public boolean isProcessed() {
}

/**
* Merges the given form into this one. For any field in <code>depends</code>
* not present in this form, include it. <code>depends</code> has precedence
* Merges the given form into this one. For any field in {@code depends}
* not present in this form, include it. {@code depends} has precedence
* in the way the fields are ordered.
*
* @param depends the form we want to merge
Expand Down Expand Up @@ -201,7 +201,7 @@ protected void merge(final Form depends) {
}

/**
* Processes all of the <code>Form</code>'s <code>Field</code>s.
* Processes all of the {@code Form}'s {@code Field}s.
*
* @param globalConstants A map of global constants
* @param constants Local constants
Expand Down
Loading

0 comments on commit 4a87127

Please sign in to comment.