Skip to content

Refactorización de código Clase Job #17

@jarenPilco

Description

@jarenPilco

El código de la clase Job está bien estructurado y cumple el principio ISP al mantener una única responsabilidad: representar la entidad sin depender de lógica de persistencia ni de presentación.

public class Job implements Serializable, Cloneable {
private static final long serialVersionUID = 9178806163995887915L;

private int id;
private int employerId;
private int priceId;
private String title;
private String description;
private Timestamp date;

public Job(int id, int employerId, int priceId, String title, String description, Timestamp date) {
    this.id = id;
    this.employerId = employerId;
    this.priceId = priceId;
    this.title = title;
    this.description = description;
    this.date = date;
}

// Getters y setters
public int getId() { return id; }
public int getEmployerId() { return employerId; }
public int getPriceId() { return priceId; }
public String getTitle() { return title; }
public String getDescription() { return description; }
public Timestamp getDate() { return date; }

@Override
public String toString() { return title; }
@Override
public int hashCode() { return Objects.hash(id, employerId, priceId, title); }
@Override
public boolean equals(Object obj) {
    if (this == obj) return true;
    if (obj == null || getClass() != obj.getClass()) return false;
    Job other = (Job) obj;
    return id == other.id && employerId == other.employerId && priceId == other.priceId;
}

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions