Refine search
private String extractCheckerLog(List<WaitChecker> checkers) { List<String> logOut = new ArrayList<>(); for (WaitChecker checker : checkers) { logOut.add(checker.getLogLabel()); } return StringUtils.join(logOut.toArray(), " and "); }
/** * @param text The text to be split. * @param separator The separator at which the text will be split. * @return The resulting array. * @see #split(String, String, int) */ @Nonnull public static String[] split( @Nonnull String text, @Nullable String separator ) { return split( text, separator, -1 ); }
/** * <p>Reverses a String that is delimited by a specific character.</p> * <p/> * <p>The Strings between the delimiters are not reversed. * Thus java.lang.String becomes String.lang.java (if the delimiter * is <code>'.'</code>).</p> * * @param str the String to reverse * @param delimiter the delimiter to use * @return the reversed String */ @Nonnull public static String reverseDelimitedString( @Nonnull String str, String delimiter ) { // could implement manually, but simple way is to reuse other, // probably slower, methods. String[] strs = split( str, delimiter ); reverseArray( strs ); return join( strs, delimiter ); }
/** * Fill all 'variables' in the given text with the values from the map. * Any text looking like '${key}' will get replaced by the value stored * in the namespace map under the 'key'. * * @param text The text where replacements will be searched for. * @param namespace The namespace which contains the replacements. * @return the interpolated text. */ public static String interpolate( String text, @Nonnull Map<?, ?> namespace ) { for ( Map.Entry<?, ?> entry : namespace.entrySet() ) { String key = entry.getKey().toString(); Object obj = entry.getValue(); if ( obj == null ) { throw new NullPointerException( "The value of the key '" + key + "' is null." ); } String value = obj.toString(); text = replace( text, "${" + key + "}", value ); if ( !key.contains( " " ) ) { text = replace( text, "$" + key, value ); } } return text; }
private static String tryBlank( String s ) { if ( s == null ) { return null; } else { String trimmed = s.trim(); return StringUtils.isEmpty( trimmed ) ? null : trimmed; } }
if ( debug && StringUtils.isNotEmpty( debuglevel ) ) String[] split = StringUtils.split( debuglevel, "," ); for ( String aSplit : split ) + StringUtils.join( project.getTestCompileSourceRoots() .iterator(), "\n " ) ); + StringUtils.join( project.getTestCompileSourceRoots() .iterator(), "\n " ) ); + StringUtils.join( project.getCompileSourceRoots() .iterator(), "\n " ) ); getLog().debug( "New compile source roots:\n " + StringUtils.join( project.getCompileSourceRoots() .iterator(), "\n " ) ); if ( !StringUtils.isEmpty( meminitial ) ) if ( !StringUtils.isEmpty( maxmem ) ) if ( key.startsWith( "-A" ) && StringUtils.isNotEmpty( value ) ) if ( !StringUtils.isEmpty( effectiveCompilerArgument ) ) if ( StringUtils.isEmpty( compilerConfiguration.getSourceEncoding() ) )
/** * Sets the file encoding of the hook scripts. * * @param encoding The file encoding of the hook scripts, may be <code>null</code> or empty to use the platform's * default encoding. */ public void setScriptEncoding( String encoding ) { this.encoding = StringUtils.isNotEmpty( encoding ) ? encoding : null; }
@Override public void execute() throws MojoExecutionException, MojoFailureException { List<MavenProject> projectList = new ArrayList<>(); if (StringUtils.isBlank(projects)) { if (reactorProjects.size() == 1) { projectList.add(reactorProjects.get(0)); for (String key : StringUtils.split(projects, ",")) { MavenProject p = projectMap.get(key); if (p == null) { if (StringUtils.isBlank(modules)) { List<String> nonGwtProjects = new ArrayList<>(); for (MavenProject p : projectList) { + StringUtils.join(nonGwtProjects.iterator(), ", ")); moduleList.addAll(Arrays.asList(StringUtils.split(modules, ",")));
if ( StringUtils.isNotEmpty( id ) ) if ( StringUtils.isEmpty( groupId ) ) if ( StringUtils.isEmpty( artifactId ) ) if ( StringUtils.isNotEmpty( scope ) ) if ( StringUtils.isNotEmpty( optional ) )
/** * <p> * Checks if a String is not empty (""), not null and not whitespace only. * </p> * <p/> * <pre> * StringUtils.isNotBlank(null) = false * StringUtils.isNotBlank("") = false * StringUtils.isNotBlank(" ") = false * StringUtils.isNotBlank("bob") = true * StringUtils.isNotBlank(" bob ") = true * </pre> * * @param str the String to check, may be null * @return <code>true</code> if the String is not empty and not null and not whitespace * */ public static boolean isNotBlank( @Nullable String str ) { return !isBlank( str ); }
/** * Returns a string array of the excludes to be used when copying the content of the WAR source directory. * * @return an array of tokens to exclude */ protected String[] getExcludes() { List<String> excludeList = new ArrayList<String>(); if ( StringUtils.isNotEmpty( warSourceExcludes ) ) { excludeList.addAll( Arrays.asList( StringUtils.split( warSourceExcludes, "," ) ) ); } // if webXML is specified, omit the one in the source directory if ( webXml != null && StringUtils.isNotEmpty( webXml.getName() ) ) { excludeList.add( "**/" + WEB_INF + "/web.xml" ); } // if contextXML is specified, omit the one in the source directory if ( containerConfigXML != null && StringUtils.isNotEmpty( containerConfigXML.getName() ) ) { excludeList.add( "**/" + META_INF + "/" + containerConfigXML.getName() ); } return excludeList.toArray( new String[excludeList.size()] ); }
/** * Returns a string array of the includes to be used when adding dependent WARs as an overlay onto this WAR. * * @return an array of tokens to include */ protected String[] getDependentWarIncludes() { return StringUtils.split( StringUtils.defaultString( dependentWarIncludes ), "," ); }
public TestListResolver( Collection<String> tests ) { final IncludedExcludedPatterns patterns = new IncludedExcludedPatterns(); final Set<ResolvedTest> includedFilters = new LinkedHashSet<>( 0 ); final Set<ResolvedTest> excludedFilters = new LinkedHashSet<>( 0 ); for ( final String csvTests : tests ) { if ( isNotBlank( csvTests ) ) { for ( String request : split( csvTests, "," ) ) { request = request.trim(); if ( !request.isEmpty() && !request.equals( "!" ) ) { resolveTestRequest( request, patterns, includedFilters, excludedFilters ); } } } } this.includedPatterns = unmodifiableSet( includedFilters ); this.excludedPatterns = unmodifiableSet( excludedFilters ); this.hasIncludedMethodPatterns = patterns.hasIncludedMethodPatterns; this.hasExcludedMethodPatterns = patterns.hasExcludedMethodPatterns; }
private List<ServicePort> extractPortsFromConfig() { List<ServicePort> ret = new LinkedList<>(); String ports = getConfig(Config.port); if (ports != null) { for (String port : StringUtils.split(ports, ",")) { ret.add(parsePortMapping(port)); } } return ret; }
private static String getProfileFileName(String fileName, String ext) { return String.format(fileName, StringUtils.isNotBlank(ext) ? "-" + ext : ""); }
String version = server.getVersion(); String platformVersion = server.getPlatformVersion(); if(StringUtils.isNotBlank(platformVersion)){ if(StringUtils.isNotBlank(server.getParam(Server.PROPERTY_VERSION))){ if(server.getParam(Server.PROPERTY_VERSION).equals("2.3")){ this.parentTask.wizard.showMessage("Please note that Reference Application 2.3 is not supported" + parentTask.distroHelper.saveDistroPropertiesTo(serverPath, distro); } else if(StringUtils.isBlank(server.getVersion())){ DistroProperties distroProperties = new DistroProperties(server.getServerId(), server.getOpenmrsCoreVersion()); distroProperties.saveTo(serverPath.getAbsoluteFile()); if(StringUtils.isNotBlank(server.getParam(Server.PROPERTY_PLATFORM))){ server.setValuesFromDistroPropertiesModules( server.getDistroProperties().getWarArtifacts(parentTask.distroHelper, server.getServerDirectory()),
String indentation = StringUtils.repeat( " ", indent * indentSize ); int magicNumber = indentation.length() + columnSize - "-->".length() - 1; String[] sentences = StringUtils.split( comment, LS ); String[] words = StringUtils.split( sentence, " " ); for ( String word : words ) line.append( StringUtils.repeat( " ", magicNumber - line.length() ) ); line.append( StringUtils.repeat( " ", magicNumber - line.length() ) ); line.append( StringUtils.repeat( " ", magicNumber - line.length() ) );
/** * <p>Replace all occurances of a char within another char.</p> * <p/> * <p>A <code>null</code> reference passed to this method is a no-op.</p> * * @param text text to search and replace in * @param repl char to search for * @param with char to replace with * @return the text with any replacements processed * @see #replace(String text, char repl, char with, int max) */ public static String replace( @Nullable String text, char repl, char with ) { return replace( text, repl, with, -1 ); }