Files
java-design-patterns/table-inheritance/src/main/java/com/iluwatar/table/inheritance/Vehicle.java
T
HabibaMekay c5a6862887 feat: Implemented the Table Inheritance pattern (#3105)
* sample classes and tests

* sample classes and tests

* read me addition

* fix violations

* fix quality (coverage)

* fix quality (coverage) #2

* resolved comments
2025-01-06 19:03:27 +02:00

49 lines
1.0 KiB
Java

package com.iluwatar.table.inheritance;
import lombok.Getter;
import lombok.Setter;
/**
* Represents a generic vehicle with basic attributes like make, model, year, and ID.
*/
@Setter
@Getter
public class Vehicle {
private String make;
private String model;
private int year;
private int id;
/**
* Constructs a Vehicle object with the given parameters.
*
* @param year the year of manufacture
* @param make the make of the vehicle
* @param model the model of the vehicle
* @param id the unique ID of the vehicle
*/
public Vehicle(int year, String make, String model, int id) {
this.make = make;
this.model = model;
this.year = year;
this.id = id;
}
/**
* Returns a string representation of the vehicle.
*
* @return a string with the vehicle's details
*/
@Override
public String toString() {
return "Vehicle{"
+ "id=" + id
+ ", make='" + make + '\''
+ ", model='" + model + '\''
+ ", year=" + year
+ '}';
}
}