Add private constructor to utility classes to hide the implicit public one (#7850)

This commit is contained in:
Ozan Uslan 2022-10-01 22:13:54 +03:00 committed by GitHub
parent 736637a598
commit 84a1b11b11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 0 deletions

View File

@ -8,6 +8,8 @@ import org.openmetadata.annotations.ExposedField;
public class AnnotationChecker {
private AnnotationChecker() {}
private static boolean checkIfAnyClassFieldsHasAnnotation(
Class<?> objectClass, Class<? extends Annotation> annotationClass) {
return checkIfAnyClassFieldsHasAnnotation(objectClass, annotationClass, new HashSet<>());

View File

@ -15,6 +15,8 @@ import org.openmetadata.service.Entity;
@Slf4j
public class ElasticSearchIndexFactory {
private ElasticSearchIndexFactory() {}
public static ElasticSearchIndex buildIndex(String entityType, EntityInterface entity) {
switch (entityType) {
case Entity.TABLE:

View File

@ -17,6 +17,8 @@ import org.openmetadata.schema.services.connections.metadata.SecretsManagerProvi
public class SecretsManagerFactory {
private SecretsManagerFactory() {}
public static SecretsManager createSecretsManager(SecretsManagerConfiguration config, String clusterName) {
SecretsManagerProvider secretManager =
config != null && config.getSecretsManager() != null

View File

@ -110,6 +110,8 @@ public class WebSocketManager {
}
public static class WebSocketManagerBuilder {
private WebSocketManagerBuilder() {}
public static void build(EngineIoServerOptions eiOptions) {
INSTANCE = new WebSocketManager(eiOptions);
}

View File

@ -267,6 +267,8 @@ public class EmailUtil {
}
public static class EmailUtilBuilder {
private EmailUtilBuilder() {}
public static EmailUtil build(SmtpSettings smtpServerSettings) {
if (INSTANCE == null) {
INSTANCE = new EmailUtil(smtpServerSettings);

View File

@ -39,6 +39,8 @@ public class FilterUtil {
private static final String TEST_CASE_RESULT = "testCaseResult";
private static final String WILDCARD_FILTER = "all";
private FilterUtil() {}
public static boolean shouldProcessRequest(ChangeEvent changeEvent, Map<String, Map<EventType, Filters>> filtersMap) {
if (filtersMap != null && !filtersMap.isEmpty()) {
String entityType = changeEvent.getEntityType();

View File

@ -34,6 +34,8 @@ public class PasswordUtil {
validator = new PasswordValidator(rules);
}
private PasswordUtil() {}
public static void validatePassword(String pwd) {
PasswordData password = new PasswordData(pwd);
RuleResult result = validator.validate(password);

View File

@ -14,6 +14,8 @@ import org.openmetadata.schema.auth.RefreshToken;
import org.openmetadata.schema.auth.TokenType;
public class TokenUtil {
private TokenUtil() {}
public static TokenInterface createNewTokenWithDefaults(UUID userId, UUID tokenId, TokenType type) {
switch (type) {
case EMAIL_VERIFICATION: