Compare commits
2 Commits
f0b79f0db0
...
2c7deaa9ae
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c7deaa9ae | |||
| 8399ab0d58 |
@ -0,0 +1,5 @@
|
|||||||
|
package ru.kamask.pet.todo.model;
|
||||||
|
|
||||||
|
public interface Identifiable {
|
||||||
|
int getId();
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
package ru.kamask.pet.todo.model;
|
package ru.kamask.pet.todo.model;
|
||||||
|
|
||||||
public abstract class Task {
|
public abstract class Task implements Identifiable{
|
||||||
private static int nextId = 1;
|
private static int nextId = 1;
|
||||||
|
|
||||||
protected int id;
|
protected int id;
|
||||||
@ -11,10 +11,15 @@ public abstract class Task {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int id() {
|
@Override
|
||||||
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int id() {
|
||||||
|
return getId();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("Задача: id - %d, title: \"%s\"", id, title);
|
return String.format("Задача: id - %d, title: \"%s\"", id, title);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user