-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathImageService.java
More file actions
26 lines (20 loc) · 856 Bytes
/
ImageService.java
File metadata and controls
26 lines (20 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package de.telran.service;
import de.telran.action.ImageAction;
import de.telran.entity.ActionableImage;
import de.telran.factory.ImageActionFactory;
import java.awt.image.BufferedImage;
public class ImageService {
private ImageActionFactory imageActionFactory;
public ImageService(ImageActionFactory imageActionFactory) {
this.imageActionFactory = imageActionFactory;
}
public ActionableImage processImage(ActionableImage image) {
ImageAction imageAction = imageActionFactory.getImageAction(image.getActionName());
try {
image.setImage(imageAction.doAction(image.getImage()));//better use copying constructor
} catch (Exception ex) {
System.out.println("Could not process image with action "+image.getActionName()+": "+ex.getMessage());
}
return image;
}
}