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"/>
|
<attribute name="optional" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
<attributes>
|
<attributes>
|
||||||
|
<attribute name="module" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
@ -38,19 +25,19 @@
|
|||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||||
<attributes>
|
<attributes>
|
||||||
|
<attribute name="ignore_optional_problems" value="true"/>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
<attribute name="ignore_optional_problems" value="true"/>
|
|
||||||
<attribute name="m2e-apt" value="true"/>
|
<attribute name="m2e-apt" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||||
<attributes>
|
<attributes>
|
||||||
|
<attribute name="ignore_optional_problems" value="true"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
<attribute name="ignore_optional_problems" value="true"/>
|
|
||||||
<attribute name="m2e-apt" value="true"/>
|
<attribute name="m2e-apt" value="true"/>
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<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;
|
package org.lapaloma.hogwarts.service;
|
||||||
|
|
||||||
/**
|
import org.lapaloma.hogwarts.vo.Casa;
|
||||||
* Isidoro Nevares Martín - Virgen de la Paloma
|
|
||||||
* Fecha creación: 9 mar 2026
|
|
||||||
*/
|
|
||||||
public class CasaService {
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,24 +13,25 @@ public class Casa {
|
|||||||
private int identificador;
|
private int identificador;
|
||||||
String nombre;
|
String nombre;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int getIdentificador() {
|
public int getIdentificador() {
|
||||||
return identificador;
|
return identificador;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIdentificador(int identificador) {
|
public void setIdentificador(int identificador) {
|
||||||
this.identificador = identificador;
|
this.identificador = identificador;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNombre() {
|
public String getNombre() {
|
||||||
return nombre;
|
return nombre;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNombre(String nombre) {
|
public void setNombre(String nombre) {
|
||||||
this.nombre = nombre;
|
this.nombre = nombre;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Casa [identificador=" + identificador + ", nombre=" + nombre + "]";
|
return "Casa [identificador=" + identificador + ", nombre=" + nombre + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user