Adicion método cambiar rol Usuario.java

parent 2a35ce69
...@@ -2,6 +2,11 @@ package com.carpooling.carpoolingaoraha.entidades; ...@@ -2,6 +2,11 @@ package com.carpooling.carpoolingaoraha.entidades;
import java.util.Date; import java.util.Date;
import com.carpooling.carpoolingaoraha.entidades.*; import com.carpooling.carpoolingaoraha.entidades.*;
import com.carpooling.carpoolingaoraha.entidades.rol.*;
import static com.carpooling.carpoolingaoraha.entidades.rol.CONDUCTOR;
import static com.carpooling.carpoolingaoraha.entidades.rol.PASAJERO;
enum rol{ enum rol{
CONDUCTOR, PASAJERO CONDUCTOR, PASAJERO
}; };
...@@ -100,4 +105,12 @@ public class Usuario { ...@@ -100,4 +105,12 @@ public class Usuario {
public void setRol(rol rol) { public void setRol(rol rol) {
this.rol = rol; this.rol = rol;
} }
public void cambiarRol(rol rol){
if(rol == CONDUCTOR){
rol = PASAJERO;
}else{
rol = CONDUCTOR;
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment