Skip to content

Commit 6301268

Browse files
committed
Add Layer classes named *Builder to provide backward compatibility.
1 parent a953c3c commit 6301268

File tree

5 files changed

+58
-0
lines changed

5 files changed

+58
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.cloudinary.transformation;
2+
3+
/**
4+
* @deprecated
5+
*/
6+
public abstract class AbstractLayerBuilder extends AbstractLayer {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.cloudinary.transformation;
2+
3+
/**
4+
* @deprecated
5+
*/
6+
public class LayerBuilder extends Layer{
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.cloudinary.transformation;
2+
3+
/**
4+
* @deprecated
5+
*/
6+
public class SubtitlesLayerBuilder extends SubtitlesLayer {
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.cloudinary.transformation;
2+
3+
/**
4+
* @deprecated
5+
*/
6+
public class TextLayerBuilder extends TextLayer {
7+
}

cloudinary-core/src/test/java/com/cloudinary/test/CloudinaryTest.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,36 @@ public void testOverlayOptions() {
932932
}
933933
}
934934

935+
936+
@Test
937+
public void testBackwardCampatibleOverlayOptions() {
938+
Object tests[] = {
939+
new LayerBuilder().publicId("logo"),
940+
"logo",
941+
new LayerBuilder().publicId("folder/logo"),
942+
"folder:logo",
943+
new LayerBuilder().publicId("logo").type("private"),
944+
"private:logo",
945+
new LayerBuilder().publicId("logo").format("png"),
946+
"logo.png",
947+
new LayerBuilder().resourceType("video").publicId("cat"),
948+
"video:cat",
949+
new TextLayerBuilder().text("Hello World, Nice to meet you?").fontFamily("Arial").fontSize(18),
950+
"text:Arial_18:Hello%20World%E2%80%9A%20Nice%20to%20meet%20you%3F",
951+
new TextLayerBuilder().text("Hello World, Nice to meet you?").fontFamily("Arial").fontSize(18)
952+
.fontWeight("bold").fontStyle("italic").letterSpacing("4"),
953+
"text:Arial_18_bold_italic_letter_spacing_4:Hello%20World%E2%80%9A%20Nice%20to%20meet%20you%3F",
954+
new SubtitlesLayerBuilder().publicId("sample_sub_en.srt"), "subtitles:sample_sub_en.srt",
955+
new SubtitlesLayerBuilder().publicId("sample_sub_he.srt").fontFamily("Arial").fontSize(40),
956+
"subtitles:Arial_40:sample_sub_he.srt" };
957+
958+
for (int i = 0; i < tests.length; i += 2) {
959+
Object layer = tests[i];
960+
String expected = (String) tests[i + 1];
961+
assertEquals(expected, layer.toString());
962+
}
963+
}
964+
935965
@Test(expected = IllegalArgumentException.class)
936966
public void testOverlayError1() {
937967
// Must supply font_family for text in overlay

0 commit comments

Comments
 (0)