squid:S1118 - Utility classes should not have public constructors (#281)

This commit is contained in:
Mohamed Ezzat 2016-04-28 18:45:39 +02:00 committed by inorichi
parent 2e6fc70353
commit 9f546d13c2
7 changed files with 35 additions and 7 deletions

View file

@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.data.database.tables;
import android.support.annotation.NonNull;
public class ChapterTable {
public final class ChapterTable {
@NonNull
public static final String TABLE = "chapters";
@ -34,6 +34,10 @@ public class ChapterTable {
@NonNull
public static final String COLUMN_CHAPTER_NUMBER = "chapter_number";
private ChapterTable() throws InstantiationException {
throw new InstantiationException("This class is not for instantiation");
}
@NonNull
public static String getCreateTableQuery() {
return "CREATE TABLE " + TABLE + "("

View file

@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.data.database.tables;
import android.support.annotation.NonNull;
public class MangaSyncTable {
public final class MangaSyncTable {
public static final String TABLE = "manga_sync";
@ -24,6 +24,10 @@ public class MangaSyncTable {
public static final String COLUMN_TOTAL_CHAPTERS = "total_chapters";
private MangaSyncTable() throws InstantiationException {
throw new InstantiationException("This class is not for instantiation");
}
@NonNull
public static String getCreateTableQuery() {
return "CREATE TABLE " + TABLE + "("

View file

@ -8,7 +8,11 @@ import android.content.pm.PackageManager;
import timber.log.Timber;
public class AndroidComponentUtil {
public final class AndroidComponentUtil {
private AndroidComponentUtil() throws InstantiationException {
throw new InstantiationException("This class is not for instantiation");
}
public static void toggleComponent(Context context, Class componentClass, boolean enable) {
Timber.i((enable ? "Enabling " : "Disabling ") + componentClass.getSimpleName());

View file

@ -8,7 +8,7 @@ import java.util.regex.Pattern;
import eu.kanade.tachiyomi.data.database.models.Chapter;
import eu.kanade.tachiyomi.data.database.models.Manga;
public class ChapterRecognition {
public final class ChapterRecognition {
private static final Pattern cleanWithToken = Pattern.compile("ch[^0-9]?\\s*(\\d+[\\.,]?\\d+)($|\\b)");
private static final Pattern uncleanWithToken = Pattern.compile("ch[^0-9]?\\s*(\\d+[\\.,]?\\d*)");
@ -23,6 +23,10 @@ public class ChapterRecognition {
private static final Pattern pPart =
Pattern.compile("(\\b|\\d)part\\s*\\d+.+");
private ChapterRecognition() throws InstantiationException {
throw new InstantiationException("This class is not for instantiation");
}
public static void parseChapterNumber(Chapter chapter, Manga manga) {
if (chapter.chapter_number != -1)
return;

View file

@ -5,7 +5,11 @@ import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
public class GLUtil {
public final class GLUtil {
private GLUtil() throws InstantiationException {
throw new InstantiationException("This class is not for instantiation");
}
public static int getMaxTextureSize() {
// Safe minimum default size

View file

@ -5,7 +5,11 @@ import android.support.annotation.Nullable;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class Parser {
public final class Parser {
private Parser() throws InstantiationException {
throw new InstantiationException("This class is not for instantiation");
}
@Nullable
public static Element element(Element container, String pattern) {

View file

@ -3,12 +3,16 @@ package eu.kanade.tachiyomi.util;
import java.net.URI;
import java.net.URISyntaxException;
public class UrlUtil {
public final class UrlUtil {
private static final String JPG = ".jpg";
private static final String PNG = ".png";
private static final String GIF = ".gif";
private UrlUtil() throws InstantiationException {
throw new InstantiationException("This class is not for instantiation");
}
public static String getPath(String s) {
try {
URI uri = new URI(s);