/** * Converts the path provided to a slash-ending form, no matter what is provided. */ public static String suffixWithSlash(final String path){ return !Strings.endsWith(path, "/") ? path + "/" : path; }
public static boolean endsWith(String string, String endsWith) { return endsWith(string, endsWith, false); }
public static boolean endsWithIgnoreCase(String string, String endsWith) { return endsWith(string, endsWith, true); }
public static String suffixWithoutSlash(final String path){ return Strings.endsWith(path, "/") ? path.substring(0, path.length() - 1) : path; }
@Override public boolean read(MessageContext context, Resource resource) { if(Strings.endsWith(resource.getFilename(), ".properties")){ readMessages(context, resource); } return false; }
@Override public Boolean apply(DatabaseMetaData dm) { try { if(Strings.containsIgnoreCase(dm.getDatabaseProductName(), "mysql") && Strings.endsWith(dm.getDatabaseProductVersion(),"-MariaDB")) { return true; } if(Strings.containsIgnoreCase(dm.getDatabaseProductName(), "MariaDB")){ return true; } return false; } catch (SQLException e) { throw Exceptions.wrap(e); } } };
@Override public boolean read(MessageContext context,Resource resource) { if(Strings.endsWith(resource.getFilename(), ".xml", true)){ loadMessages(context, resource, context.isDefaultOverride(), null); return true; } return false; }
public static String formatApiEndPoint(String apiEndPoint) { if (apiEndPoint.contains("{context}")) { String contextPath = Request.tryGetCurrent().getServletRequest().getContextPath(); apiEndPoint = apiEndPoint.replace("{context}", Strings.trimStart(contextPath, '/')); //apiEndPoint=apiEndPoint.replace("//", "/"); } if (apiEndPoint.contains("~")) { HttpServletRequest request = Request.tryGetCurrent().getServletRequest(); apiEndPoint = apiEndPoint.replace("~", Strings.format("{0}://{1}:{2}", request.getScheme(), curServerLocalIp(), request.getLocalPort())); } if (apiEndPoint.startsWith("/")) { HttpServletRequest request = Request.tryGetCurrent().getServletRequest(); apiEndPoint = Strings.format("{0}://{1}:{2}", request.getScheme(), "127.0.0.1", request.getLocalPort()) + apiEndPoint; } if (Strings.endsWith(apiEndPoint, "/")) { apiEndPoint = Strings.trimEnd(apiEndPoint, '/'); } return apiEndPoint; }
@Override public boolean readSqlCommands(SqlReaderContext context, Resource resource) throws IOException { if(Strings.endsWith(resource.getFilename(),".xml")){ Map<String, DefaultSqlCommand> sqls = loadedSqls.get(resource.getURLString()); if(null == sqls) { sqls = new HashMap<>(); loadedSqls.put(resource.getURLString(), sqls); loadSqls(context,resource,context.isDefaultOverride(), sqls); } loadSqls(context, sqls); return true; } return false; }
if(null != resource.getClasspath() && Strings.endsWith(resource.getFilename(),Classes.CLASS_FILE_SUFFIX)){ InputStream is = null; try{