ch5.requiredValidation
Class RequestDataRequired

java.lang.Object
  extended by ch5.requiredValidation.RequestDataRequired

public class RequestDataRequired
extends java.lang.Object

Add annotations for required validation. Pattern and NotNull are the annotations that are added to the accessors for the hobby and aversion properties.


Field Summary
protected  java.lang.String aversion
          The variable to store the aversion.
protected  java.lang.String hobby
          The variable to store the hobby.
 
Constructor Summary
RequestDataRequired()
           
 
Method Summary
 java.lang.String getAversion()
          The accessor for the aversion property.
 java.lang.String getHobby()
          The accessor for the hobby property.
 void setAversion(java.lang.String aversion)
          The mutator for the aversion property.
 void setHobby(java.lang.String hobby)
          The mutator for the hobby property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hobby

protected java.lang.String hobby
The variable to store the hobby. The varible is hidden from other classes, so it doesn't matter what name it has.


aversion

protected java.lang.String aversion
The variable to store the aversion. The varible is hidden from other classes, so it doesn't matter what name it has.

Constructor Detail

RequestDataRequired

public RequestDataRequired()
Method Detail

setHobby

public void setHobby(java.lang.String hobby)
The mutator for the hobby property. This name must agree with the name of the input element from the HTML page where the user enters data. The name of the input element should be hobby.

Parameters:
hobby - The hobby from the request data.

getHobby

@Pattern(regex=".*\\S.*",
         message="cannot be empty")
@NotNull
public java.lang.String getHobby()
The accessor for the hobby property. It implements required validation. If the hobby is not valid, then an error will be generated for it. Required validation is implemented with the Pattern and NotNull annotations. This name must agree with the name of the input element from the HTML page where the user enters data. The name of the input element should be hobby.

Returns:
The hobby that was entered.

setAversion

public void setAversion(java.lang.String aversion)
The mutator for the aversion property. This name must agree with the name of the input element from the HTML page where the user enters data. The name of the input element should be aversion.

Parameters:
aversion - The aversion from the request data.

getAversion

@Pattern(regex=".*\\S.*",
         message="cannot be empty")
@NotNull
public java.lang.String getAversion()
The accessor for the aversion property. It implements required validation. If the aversion is not valid, then an error will be generated for it. Required validation is implemented with the Pattern and NotNull annotations. This name must agree with the name of the input element from the HTML page where the user enters data. The name of the input element should be aversion.

Returns:
The aversion that was entered.