Skip to content

Commit

Permalink
style: make utility classes proper utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
vil02 committed Oct 7, 2024
1 parent 43d8e9a commit 19fc5a1
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class SmartUrlEncoder {
public final class SmartUrlEncoder {
private SmartUrlEncoder() {}

public static String encode(String input) {
try {
return URLEncoder.encode(input, "UTF-8").replace("%2F", "/").replace("%3A", ":").replace("+", "%20");
Expand Down
4 changes: 3 additions & 1 deletion cloudinary-core/src/main/java/com/cloudinary/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import java.security.NoSuchAlgorithmException;
import java.util.*;

public class Util {
public final class Util {
private Util() {}

static final String[] BOOLEAN_UPLOAD_OPTIONS = new String[]{"backup", "exif", "faces", "colors", "image_metadata", "use_filename", "unique_filename",
"eager_async", "invalidate", "discard_original_filename", "overwrite", "phash", "return_delete_token", "async", "quality_analysis", "cinemagraph_analysis",
"accessibility_analysis", "use_filename_as_display_name", "use_asset_folder_as_public_id_prefix", "unique_display_name", "media_metadata", "visual_search",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.util.HashMap;
import java.util.Map;

public class Base64Map {
public final class Base64Map {
private Base64Map() {}

public static Map<String, String> values;

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* this program code.
*/

public class HtmlEscape {
public final class HtmlEscape {
private HtmlEscape() {}

private static char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import java.util.*;


public class ObjectUtils {
public final class ObjectUtils {
private ObjectUtils() {}

/**
* Formats a Date as an ISO-8601 string representation.
* @param date Date to format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUtils {
public final class StringUtils {
private StringUtils() {}

public static final String EMPTY = "";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

import java.util.*;

public class ApiUtils {
public final class ApiUtils {
private ApiUtils() {}

public static void setTimeouts(HttpUriRequestBase request, Map<String, ? extends Object> options) {
RequestConfig config = request.getConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
*
* @author jpollak
*/
public class Singleton {
public final class Singleton {
private Singleton() {}

private static Cloudinary cloudinary;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ public void testRateLimits() throws Exception {

@Test
public void testConfiguration() throws Exception {
ApiResponse result = cloudinary.api().configuration(new ObjectUtils().asMap("settings", true));
ApiResponse result = cloudinary.api().configuration(ObjectUtils.asMap("settings", true));
Map settings = (Map) result.get("settings");
Assert.assertNotNull(settings.get("folder_mode"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import com.cloudinary.metadata.MetadataValidation;
import com.cloudinary.metadata.StringMetadataField;

public class MetadataTestHelper {
public final class MetadataTestHelper {
private MetadataTestHelper() {}

public static StringMetadataField newFieldInstance(String label, Boolean mandatory) throws Exception {
StringMetadataField field = new StringMetadataField();
field.setLabel(label);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.cloudinary.test.helpers;

public class Feature {
public final class Feature {
private Feature() {}

public static final String ALL = "all";
public static final String DYNAMIC_FOLDERS = "dynamic_folders";
public static final String BACKEDUP_ASSETS = "backedup_assets";
Expand Down

0 comments on commit 19fc5a1

Please sign in to comment.