You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1.2 KiB
25 lines
1.2 KiB
import java.time.LocalDateTime;
|
|
|
|
public enum PackageFactory {
|
|
Book {
|
|
public PackageInfo getInstance(String name, String notes, double price, double weight, boolean delivered, LocalDateTime expectedDate, String author) {
|
|
return new BookPackage(name, notes, price, weight, delivered, expectedDate, author);
|
|
}
|
|
}
|
|
|
|
Perishable {
|
|
public PackageInfo getInstance (String name, String notes,double price, double weight,
|
|
boolean delivered, LocalDateTime expectedDate, LocalDateTime expiryDate){
|
|
return new PerishablePackage(name, notes, price, weight, delivered, expectedDate, expiryDate);
|
|
}
|
|
}
|
|
|
|
Electronic{
|
|
public PackageInfo getInstance(String name, String notes, double price, double weight, boolean delivered, LocalDateTime expectedDate, double handlingFee){
|
|
return new ElectronicPackage(name, notes, price, weight, delivered, expectedDate, handlingFee);
|
|
}
|
|
}
|
|
}
|
|
//public static PackageInfo getInstance(PackageType type, String name, String notes, double price, double weight, boolean delivered, LocalDateTime expectedDate, @Nullable String author, @Nullable LocalDateTime expiryDate, @Nullable double handlingFee){
|
|
//}
|