Skip to content

Commit 62a5341

Browse files
nitzanjtocker
authored andcommitted
Add generics to Transformation class, Streaming profile support.
Allows for chaining commands when working with derived classes and calling a super method. Eager transformation generation logic moved from `Utils`into 'EagerTransformation'.
1 parent a1eb3ad commit 62a5341

File tree

5 files changed

+123
-104
lines changed

5 files changed

+123
-104
lines changed

cloudinary-core/src/main/java/com/cloudinary/EagerTransformation.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package com.cloudinary;
22

3+
import com.cloudinary.utils.StringUtils;
4+
5+
import java.util.ArrayList;
36
import java.util.List;
47
import java.util.Map;
58

6-
public class EagerTransformation extends Transformation {
9+
public class EagerTransformation extends Transformation<EagerTransformation> {
710
protected String format;
811

912
@SuppressWarnings("rawtypes")
@@ -23,4 +26,16 @@ public EagerTransformation format(String format) {
2326
public String getFormat() {
2427
return format;
2528
}
29+
30+
@Override
31+
public String generate(Map options) {
32+
List<String> eager = new ArrayList<>();
33+
eager.add(super.generate(options));
34+
35+
if (StringUtils.isNotBlank(format)){
36+
eager.add(format);
37+
}
38+
39+
return StringUtils.join(eager, "/");
40+
}
2641
}

0 commit comments

Comments
 (0)