-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Agregar ´proyecto JavaBeans dentro Leccion 7 en Semana 8
- Loading branch information
1 parent
18bdad7
commit b4b4d4e
Showing
4 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### IntelliJ IDEA ### | ||
/.idea/ | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>ar.com.utnfrsr</groupId> | ||
<artifactId>JavaBeans</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
</project> |
40 changes: 40 additions & 0 deletions
40
Java/Semana8/Leccion 7/JavaBeans/src/main/java/ar/com/utnfrsr/domain/Persona.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package ar.com.utnfrsr.domain; | ||
|
||
import java.io.Serializable; | ||
|
||
public class Persona implements Serializable { | ||
private String nombre; | ||
private String apellido; | ||
|
||
//Constructor Vacio: esto es obligatorio | ||
public Persona() { | ||
} | ||
|
||
//Constructor con parametros | ||
public Persona(String nombre, String apellido) { | ||
this.nombre = nombre; | ||
this.apellido = apellido; | ||
} | ||
|
||
//Metodos Getters y Setters: estos son obligatorios estando encapsulados | ||
public String getNombre() { | ||
return nombre; | ||
} | ||
|
||
public void setNombre(String nombre) { | ||
this.nombre = nombre; | ||
} | ||
|
||
public String getApellido() { | ||
return apellido; | ||
} | ||
|
||
public void setApellido(String apellido) { | ||
this.apellido = apellido; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Persona{" + "nombre=" + nombre + ", apellido=" + apellido + '}'; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Java/Semana8/Leccion 7/JavaBeans/src/main/java/ar/com/utnfrsr/test/TestJavaBeans.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ar.com.utnfrsr.test; | ||
|
||
import ar.com.utnfrsr.domain.Persona; | ||
|
||
public class TestJavaBeans { | ||
public static void main(String[] args) { | ||
Persona persona = new Persona(); | ||
persona.setNombre("Juan"); | ||
persona.setApellido("Perez"); | ||
System.out.println("Persona = " + persona); | ||
|
||
System.out.println("Persona Nombre: " + persona.getNombre()); | ||
System.out.println("Persona Apellido: " + persona.getApellido()); | ||
|
||
//El tema de los Beans es para que se puedan usar en diferentes tecnologias | ||
//como por ejemplo en JSP, JSF, etc. | ||
//En JSP se puede usar con Expression Language (EL) para acceder a los atributo de un Bean. | ||
//En JSF se puede usar con Expression Language (EL) para acceder a los atributo de un Bean. | ||
//La implementación de Serializable es para que se pueda guardar en un archivo, en una base de datos, etc. | ||
//es decir que el contenido de un Bean se pueda persistir. | ||
//Ya que el mismo se almacena en 0 y 1, lo que se vuvelve facil de retransmitir por la red. | ||
} | ||
} |