backend/restservice/src/main/java/com/plannaplan/responses/models/abstracts/CoursesResponse.java

47 lines
905 B
Java
Raw Normal View History

2020-10-13 17:13:43 +02:00
package com.plannaplan.responses.models.abstracts;
2020-10-09 14:53:54 +02:00
import com.plannaplan.entities.Course;
2021-01-15 17:45:29 +01:00
/**
* Course entity api response
*/
2020-10-13 16:19:40 +02:00
public abstract class CoursesResponse {
2020-10-09 14:53:54 +02:00
private Long id;
private String name;
2021-01-22 12:34:54 +01:00
private String symbol;
2020-10-09 14:53:54 +02:00
2021-01-15 17:45:29 +01:00
/**
* create instance
*
* @param course entity to map to api response
*/
2020-10-09 14:53:54 +02:00
public CoursesResponse(Course course) {
this.id = course.getId() != null ? course.getId() : null;
this.name = course.getName() != null ? course.getName() : "";
2021-01-22 12:34:54 +01:00
this.symbol = course.getSymbol() != null ? course.getSymbol() : "";
2020-10-09 14:53:54 +02:00
}
2021-01-15 17:45:29 +01:00
/**
* @return course name
*/
2020-10-09 14:53:54 +02:00
public String getName() {
return name;
}
2021-01-22 12:34:54 +01:00
/**
* @return course symbol
*/
public String getSymbol() {
return symbol;
}
2021-01-15 17:45:29 +01:00
/**
* @return db id
*/
2020-10-09 14:53:54 +02:00
public Long getId() {
return id;
}
}