Métodos de servicio
This commit is contained in:
parent
64276be426
commit
8c47a2ed9e
21
.classpath
21
.classpath
@ -12,22 +12,9 @@
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
@ -38,19 +25,19 @@
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||
<attributes>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
|
||||
2
.settings/org.eclipse.core.resources.prefs
Normal file
2
.settings/org.eclipse.core.resources.prefs
Normal file
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
@ -3,10 +3,31 @@
|
||||
*/
|
||||
package org.lapaloma.hogwarts.service;
|
||||
|
||||
/**
|
||||
* Isidoro Nevares Martín - Virgen de la Paloma
|
||||
* Fecha creación: 9 mar 2026
|
||||
*/
|
||||
public class CasaService {
|
||||
import org.lapaloma.hogwarts.vo.Casa;
|
||||
|
||||
/**
|
||||
* Isidoro Nevares Martín - Virgen de la Paloma Fecha creación: 9 mar 2026
|
||||
*/
|
||||
public class CasaService {
|
||||
public boolean tieneNombre(Casa casa) {
|
||||
if (casa == null) {
|
||||
return false;
|
||||
}
|
||||
String nombre = casa.getNombre();
|
||||
return nombre != null && !nombre.trim().isEmpty();
|
||||
}
|
||||
|
||||
public String obtenerNnombreEnMayusculas(Casa casa) {
|
||||
if (!tieneNombre(casa)) {
|
||||
return null;
|
||||
}
|
||||
return casa.getNombre().toUpperCase();
|
||||
}
|
||||
|
||||
public boolean esCasaValida(Casa casa) {
|
||||
if (casa == null || casa.getIdentificador() <= 0) {
|
||||
return false;
|
||||
}
|
||||
return tieneNombre(casa);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,27 +10,28 @@ package org.lapaloma.hogwarts.vo;
|
||||
*
|
||||
*/
|
||||
public class Casa {
|
||||
private int identificador;
|
||||
String nombre;
|
||||
private int identificador;
|
||||
String nombre;
|
||||
|
||||
public int getIdentificador() {
|
||||
return identificador;
|
||||
}
|
||||
|
||||
public void setIdentificador(int identificador) {
|
||||
this.identificador = identificador;
|
||||
}
|
||||
|
||||
public int getIdentificador() {
|
||||
return identificador;
|
||||
}
|
||||
public void setIdentificador(int identificador) {
|
||||
this.identificador = identificador;
|
||||
}
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Casa [identificador=" + identificador + ", nombre=" + nombre + "]";
|
||||
}
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Casa [identificador=" + identificador + ", nombre=" + nombre + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user