List of usage examples for org.apache.commons.lang3 StringUtils startsWithIgnoreCase
public static boolean startsWithIgnoreCase(final CharSequence str, final CharSequence prefix)
Case insensitive check if a CharSequence starts with a specified prefix.
null s are handled without exceptions.
From source file:org.eclipse.php.internal.core.codeassist.strategies.TypeCastingStrategy.java
public void apply(ICompletionReporter reporter) throws BadLocationException { ICompletionContext context = getContext(); ISourceRange range = getReplacementRange(context); TypeCastingContext typeCastingContext = (TypeCastingContext) context; String prefix = typeCastingContext.getPrefix(); for (String cast : TYPE_CASTS) { if (StringUtils.startsWithIgnoreCase(cast, prefix)) { reporter.reportKeyword(cast, "", range); //$NON-NLS-1$ }/*from w w w.j a v a2 s .c o m*/ } }
From source file:org.eclipse.php.internal.core.language.keywords.PHPKeywords.java
/** * Returns a list of keyword code assist auto-complete information by prefix * //from w ww . j av a2s . co m * @param prefix * @return keywords info list */ public Collection<KeywordData> findByPrefix(String prefix) { List<KeywordData> result = new LinkedList<KeywordData>(); if (prefix == null) { return result; } for (KeywordData data : keywordData) { if (data.name.startsWith(prefix) || (data.ignoreCase && StringUtils.startsWithIgnoreCase(data.name, prefix))) { result.add(data); } } return result; }
From source file:org.eclipse.php.internal.core.language.keywords.PHPKeywords.java
/** * Returns a list of keywords by prefix/*from w w w . j av a 2 s . c o m*/ * * @param prefix * @return keywords info list */ public Collection<String> findNamesByPrefix(String prefix) { List<String> result = new LinkedList<String>(); if (prefix == null) { return result; } for (KeywordData data : keywordData) { if (data.name.startsWith(prefix) || (data.ignoreCase && StringUtils.startsWithIgnoreCase(data.name, prefix))) { result.add(data.name); } } return result; }
From source file:org.eclipse.php.internal.ui.corext.util.TypeInfoFilter.java
public boolean matchesRawNamePattern(TypeNameMatch type) { return StringUtils.startsWithIgnoreCase(type.getSimpleTypeName(), fNameMatcher.getPattern()); }
From source file:org.esigate.test.cases.ResponseHeadersTest.java
public void testVia() throws Exception { // HttpCache adds its own Via header but according to RFC2616 sec 4.2 it // is valid to append a new header instead of combining it with the // existing header. String resp = sendRequestAndExpectResponseHeader("Via", "1.1 EsiGate"); if (!StringUtils.startsWithIgnoreCase(resp, "1.1 EsiGate")) { fail("HTTP header Via should be forwarded, expected 'Via: 1.1 EsiGate...', got '" + resp + "'"); }/* w w w. j a va 2 s . c o m*/ }
From source file:org.gvnix.service.roo.addon.addon.ServiceCommands.java
/** * Command to export a method as a web service operation. * <p>// w w w .jav a 2 s .c om * Parameters: * </p> * <ul> * <li>``--class`` (mandatory) Class to export a method.</li> * <li>``--method``(mandatory) Method to export.</li> * <li>``--operationName`` Name of the method to be showed as a Web Service * operation.</li> * <li>``--resultName`` Method result name.</li> * <li>``--resultNamespace`` Namespace of the result type.</li> * <li>``--responseWrapperName`` Name to define the Response Wrapper Object. * </li> * <li>``--responseWrapperNamespace``: Namespace of the Response Wrapper * Object.</li> * <li>``--requestWrapperName``: Name to define the Request Wrapper Object.</li> * <li>``--requestWrapperNamespace``: Namespace of the Request Wrapper * Object.</li> * </ul> */ @CliCommand(value = "remote service export operation", help = "Publish a class method as web service operation in a PortType.") public void serviceExportOperation( @CliOption(key = "class", mandatory = true, help = "Name of the service class to export a method.") JavaType serviceClass, @CliOption(key = "method", mandatory = true, help = "Method to export as Web Service Operation.") JavaSymbolName methodName, @CliOption(key = "operationName", mandatory = false, help = "Name of the method to be showed as a Web Service operation.") String operationName, @CliOption(key = "resultName", mandatory = false, help = "Method result name.") String resultName, @CliOption(key = "resultNamespace", mandatory = false, help = "NNamespace of the result type. \ni.e.: 'http://services.project.service.test.gvnix.org/'. It must have URI format.") String resultNamespace, @CliOption(key = "responseWrapperName", mandatory = false, help = "Name to define the Response Wrapper Object.") String responseWrapperName, @CliOption(key = "responseWrapperNamespace", mandatory = false, help = "Namespace of the Response Wrapper Object. \ni.e.: 'http://services.project.service.test.gvnix.org/'. It must have URI format.") String responseWrapperNamespace, @CliOption(key = "requestWrapperName", mandatory = false, help = "Name to define the Request Wrapper Object.") String requestWrapperName, @CliOption(key = "requestWrapperNamespace", mandatory = false, help = "Namespace of the Request Wrapper Object. \ni.e.: 'http://services.project.service.test.gvnix.org/'. It must have URI format.") String requestWrapperNamespace) { if (StringUtils.isNotBlank(resultNamespace)) { Validate.isTrue(StringUtils.startsWithIgnoreCase(resultNamespace, "http://"), "Name space for WebResult is not correctly defined. It must have URI format."); } if (StringUtils.isNotBlank(requestWrapperNamespace)) { Validate.isTrue(StringUtils.startsWithIgnoreCase(requestWrapperNamespace, "http://"), "Name space for RequestWrapper is not correctly defined. It must have URI format."); } if (StringUtils.isNotBlank(responseWrapperNamespace)) { Validate.isTrue(StringUtils.startsWithIgnoreCase(responseWrapperNamespace, "http://"), "Name space for ResponsetWrapper is not correctly defined. It must have URI format."); } wSExportOperations.exportOperation(serviceClass, methodName, operationName, resultName, resultNamespace, responseWrapperName, responseWrapperNamespace, requestWrapperName, requestWrapperNamespace); }
From source file:org.gvnix.service.roo.addon.addon.ws.WSConfigServiceImpl.java
/** * Remove the "file:" prefix from a location string. * // w w w .j a v a 2s. c om * @param location Location * @return Location withou prefix */ private String removeFilePrefix(String location) { String prefix = "file:"; if (StringUtils.startsWithIgnoreCase(location, prefix)) { return location.substring(prefix.length()); } return location; }
From source file:org.jamwiki.parser.LinkUtil.java
/** * Utility method for determining a topic's page name given its namespace and full * topic name./* w ww .j a va 2 s .c om*/ * * @param namespace The namespace for the topic name. * @param virtualWiki The virtual wiki for the topic. * @param topicName The full topic name that is being split. * @return The pageName portion of the topic name. If the topic is "Comments:Main Page" * then the page name is "Main Page". */ public static String retrieveTopicPageName(Namespace namespace, String virtualWiki, String topicName) { if (namespace.getId() == Namespace.MAIN_ID) { return topicName; } if (StringUtils.startsWithIgnoreCase(topicName, namespace.getLabel(virtualWiki))) { // translated namespace return topicName.substring(namespace.getLabel(virtualWiki).length() + Namespace.SEPARATOR.length()); } else if (StringUtils.startsWithIgnoreCase(topicName, namespace.getDefaultLabel())) { // translated namespace available, but using the default namespace label return topicName.substring(namespace.getDefaultLabel().length() + Namespace.SEPARATOR.length()); } throw new IllegalArgumentException( "Invalid topic name & namespace combination: " + namespace.getId() + " / " + topicName); }
From source file:org.jboss.aerogear.unifiedpush.rest.registry.applications.AliasEndpoint.java
@GET @Path("/isassociated/{alias}") @Produces(MediaType.APPLICATION_JSON)//from w ww . j av a 2s . c o m @ReturnType("org.jboss.aerogear.unifiedpush.service.impl.AliasServiceImpl.Associated") public Response isAssociated(@PathParam("alias") String alias, @QueryParam("fqdn") String fqdn, @Context HttpServletRequest request) { Associated associated = aliasService.associated(alias, fqdn); if (associated.isAssociated()) { StringBuffer domain = new StringBuffer(KeycloakServiceImpl.stripClientPrefix(associated.getClient())); try { URI uri = new URI(request.getRequestURI()); if (StringUtils.startsWithIgnoreCase(uri.getHost(), domain.toString())) { // Already subdomain access, use host as subdomain associated.setSubdomain(uri.getHost()); } else { domain.append(associated.getSeperator()); domain.append(request.getServerName()); associated.setSubdomain(domain.toString()); } } catch (URISyntaxException e) { logger.error("Unable to create URI from URL:" + request.getRequestURI(), e); } } return appendAllowOriginHeader(Response.ok().entity(associated), request); }
From source file:org.jtwig.loader.impl.ClasspathLoader.java
protected String normalizeName(String name) { if (StringUtils.startsWithIgnoreCase(name, "classpath:")) { name = StringUtils.removeStartIgnoreCase(name, "classpath:"); }/*w w w . j av a 2 s. c om*/ name = "/" + StringUtils.strip(name, "/\\"); String path = new File(name).toURI().normalize().getRawPath(); return StringUtils.stripStart(path, "/\\"); }