Java back-end server programming; includes various exercises
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

40 lines
989 B

// Pekka Helenius <fincer89@hotmail.com>, Fjordtek 2020
package com.fjordtek.chapter2_task2_listhandling.domain;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
public class Student {
/*
* NOTE: These constraints are not used because
* we use hard-coded, pre-defined list with correct values
* already supplied. These would be useful for user input
* fields in a web page.
*/
@NotNull
@Pattern(regexp="^[a-zA-Z]+$")
private String firstName;
@NotNull
@Pattern(regexp="^[a-zA-Z]+$")
private String lastName;
public Student(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
public String getfirstName() {
return firstName;
}
public String getlastName() {
return lastName;
}
@Override
public String toString() {
return this.firstName + " " + this.lastName;
}
}