List of usage examples for org.apache.commons.lang StringUtils startsWith
public static boolean startsWith(String str, String prefix)
Check if a String starts with a specified prefix.
From source file:com.impetus.kundera.metadata.mappedsuperclass.InvalidSuperClassTest.java
@Test public void setup() { try {// w w w . j a va 2 s. c om EntityManagerFactory emf = Persistence.createEntityManagerFactory(persistenceUnit); Assert.fail("Should have gone to catch block!"); } catch (MetamodelLoaderException mlex) { Assert.assertTrue(StringUtils.startsWith(mlex.getMessage(), "Class:class com.impetus.kundera.metadata.mappedsuperclass.InvalidPersonEntityis annotated with @MappedSuperClass and @Entity not allowed")); } }
From source file:com.activecq.experiments.activedecorator.mapdecorators.base.AbstractMapDecorator.java
protected boolean isSystemProperty(final String key) { if (ArrayUtils.contains(SYSTEM_PROPERTY_WHITE_LIST, key)) { return false; } else if (StringUtils.startsWith(key, "nt:") || StringUtils.startsWith(key, "jcr:") || StringUtils.startsWith(key, "sling:") || StringUtils.startsWith(key, "cq:")) { return true; }/*from w w w . j a v a 2s .co m*/ return false; }
From source file:AIR.Common.Web.Session.Server.java
public static String resolveUrl(String relativePath) { if (StringUtils.isEmpty(relativePath)) relativePath = ""; // Shiva/Sajib: Do not do .toLowerCase() if (StringUtils.startsWith(relativePath, "http")) return relativePath; if (StringUtils.startsWith(relativePath, "~/")) { return getContextPath() + relativePath.substring(1); } else if (StringUtils.startsWith(relativePath, "/")) return getContextPath() + relativePath; return getContextPath() + "/" + relativePath; }
From source file:it.openutils.mgnlaws.magnolia.init.ClasspathPropertiesInitializer.java
@Override public boolean loadPropertiesFile(String rootPath, String location) { if (StringUtils.startsWith(location, CLASSPATH_PREFIX)) { String resource = StringUtils.substringAfter(location, CLASSPATH_PREFIX); InputStream propertiesInputStream = getClass().getResourceAsStream(resource); if (propertiesInputStream == null) { log.debug("Configuration file not found with classpath [{}]", resource); //$NON-NLS-1$ return false; }//from w ww . j av a 2 s.co m try { SystemProperty.getProperties().load(propertiesInputStream); log.info("Loading configuration at {}", location);//$NON-NLS-1$ } catch (Exception e) { log.error(e.getMessage(), e); return false; } finally { IOUtils.closeQuietly(propertiesInputStream); } return true; } else { return super.loadPropertiesFile(rootPath, location); } }
From source file:com.edm.utils.consts.UrlMap.java
public static final String getAction(String link) { for (UrlMap mapping : UrlMap.values()) { if (mapping.getLinks() == null || mapping.getLinks().length == 0) { continue; }//from w w w . j a v a 2 s . c om for (String action : mapping.getLinks()) { if (StringUtils.startsWith(link, action)) { return mapping.getAction(); } } } return null; }
From source file:com.jayway.maven.plugins.android.asm.DecendantFinder.java
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {/*from ww w. j ava 2 s . c o m*/ for (String testPackage : parentPackages) { if (StringUtils.startsWith(superName, testPackage)) { flagAsFound(); // System.out.println(name + " extends " + superName); } } }
From source file:com.thinkbiganalytics.feedmgr.service.EncryptionService.java
public String decrypt(String str) { if (!StringUtils.startsWith(str, encryptedPrefix)) { str = encryptedPrefix + str;//from w w w.ja v a2 s. c om } return encryptionController.decrypt(str, MediaType.TEXT_PLAIN); }
From source file:com.thoughtworks.go.util.json.JsonString.java
public boolean contains(Json json) { if (json instanceof JsonString) { JsonString jsonString = (JsonString) json; if (StringUtils.startsWith(jsonString.value, "RegEx:")) { Pattern pattern = Pattern.compile(replace(jsonString.value, "RegEx:", "")); Matcher matcher = pattern.matcher(this.value); return matcher.find(); } else {//from w w w . j a va2s. c om return StringUtils.equals(this.value, jsonString.value); } } else if (json instanceof JsonI18NResolvable) { return json.contains(this); } return false; }
From source file:com.apexxs.neonblack.utilities.Hints.java
public Hints() { try {//from w w w. j a v a 2 s.co m File f = new File(config.getResourceDirectory() + "/Hints.txt"); BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(f))); String line; while ((line = r.readLine()) != null) { if (!StringUtils.startsWith(line, "#")) { String[] tokens = line.split(";"); hintMap.put(tokens[0], tokens[1]); } } } catch (Exception ex) { logger.error("Error loading hints file: " + ex.getMessage()); } }
From source file:com.intel.cosbench.driver.generator.HistogramIntGenerator.java
public static HistogramIntGenerator parse(String pattern) { if (!StringUtils.startsWith(pattern, "h(")) return null; try {//from ww w. ja va 2s. c o m return tryParse(pattern); } catch (Exception e) { } String msg = "illegal histogram distribution pattern: " + pattern; throw new ConfigException(msg); }