当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.isBlank方法代码示例

本文整理汇总了Java中org.codehaus.plexus.util.StringUtils.isBlank方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.isBlank方法的具体用法?Java StringUtils.isBlank怎么用?Java StringUtils.isBlank使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.codehaus.plexus.util.StringUtils的用法示例。


在下文中一共展示了StringUtils.isBlank方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: format

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * replaces inner references to other
 * 
 * @param message
 *          the message pattern
 * @param file
 *          the properties file model where to look for the references
 * @return the message with the inner resource references replaced by their corresponding values
 * @throws IllegalArgumentException
 *           when the references are not correct of referencing non existing keys in the properties file
 * @see Formatter#format(String, Object...)
 */
public String format(String message, PropertiesFile file) throws IllegalArgumentException {
  StringBuffer resultBuffer = new StringBuffer();
  Matcher matcher = innerResourcePattern.matcher(message);
  while (matcher.find()) {
    String innerKey = matcher.group(1);
    if (StringUtils.isBlank(innerKey)) {
      throw new IllegalArgumentException(String.format(
          "Could not extract inner key with regex %s in %s", innerResourceRegex, matcher.group()));
    }
    String value = file.getProperties().getProperty(innerKey);
    if (value == null) {
      throw new IllegalArgumentException(String.format(
          "Inner key <%s> not found in property file <%s>", innerKey, file.getFileName()));
    }
    matcher.appendReplacement(resultBuffer, value);
  }
  matcher.appendTail(resultBuffer);
  return resultBuffer.toString();
}
 
开发者ID:rquinio,项目名称:l10n-maven-plugin,代码行数:32,代码来源:InnerResourcesFormatter.java

示例2: merge

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * Applies the glossYaml on top of the baseYaml and returns the result.
 *
 * @param baseYaml  the base Yaml.
 * @param glossYaml the Yaml to overide the base with.
 * @return the resulting Yaml.
 */
public static String merge(String baseYaml, String glossYaml)
{
    if (StringUtils.isBlank(glossYaml))
    {
        return baseYaml;
    }
    if (StringUtils.isBlank(baseYaml))
    {
        return glossYaml;
    }
    Yaml yaml = new Yaml();
    Map<String, Object> baseMap = (Map<String, Object>) yaml.load(baseYaml);
    Map<String, Object> glossMap = (Map<String, Object>) yaml.load(glossYaml);
    for (Map.Entry<String, Object> glossEntry : glossMap.entrySet())
    {
        baseMap.put(glossEntry.getKey(), glossEntry.getValue());
    }
    return yaml.dump(baseMap);
}
 
开发者ID:mojohaus,项目名称:cassandra-maven-plugin,代码行数:27,代码来源:Utils.java

示例3: info

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * Get info from scm.
 *
 * @param repository
 * @param fileSet
 * @return
 * @throws ScmException
 * @todo this should be rolled into org.apache.maven.scm.provider.ScmProvider and
 *       org.apache.maven.scm.provider.svn.SvnScmProvider
 */
protected InfoScmResult info( ScmRepository repository, ScmFileSet fileSet )
    throws ScmException
{
    CommandParameters commandParameters = new CommandParameters();

    // only for Git, we will make a test for shortRevisionLength parameter
    if ( GitScmProviderRepository.PROTOCOL_GIT.equals( scmManager.getProviderByRepository( repository ).getScmType() )
        && this.shortRevisionLength > 0 )
    {
        getLog().info( "ShortRevision tag detected. The value is '" + this.shortRevisionLength + "'." );
        if ( shortRevisionLength >= 0 && shortRevisionLength < 4 )
        {
            getLog().warn( "shortRevision parameter less then 4. ShortRevisionLength is relaying on 'git rev-parese --short=LENGTH' command, accordingly to Git rev-parse specification the LENGTH value is miminum 4. " );
        }
        commandParameters.setInt( CommandParameter.SCM_SHORT_REVISION_LENGTH, this.shortRevisionLength );
    }

    if ( !StringUtils.isBlank( scmTag ) && !"HEAD".equals( scmTag ) )
    {
        commandParameters.setScmVersion( CommandParameter.SCM_VERSION, new ScmTag( scmTag ) );
    }

    return scmManager.getProviderByRepository( repository ).info( repository.getProviderRepository(), fileSet,
                                                                  commandParameters );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:36,代码来源:AbstractScmMojo.java

示例4: validate

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
public void validate()
{
    if ( StringUtils.isBlank( name ) )
    {
        throw new IllegalArgumentException( "name required" );
    }

    if ( StringUtils.isBlank( value ) )
    {
        throw new IllegalArgumentException( "value required" );
    }

    if ( StringUtils.isBlank( regex ) )
    {
        throw new IllegalArgumentException( "regex required" );
    }

    if ( toLowerCase && toUpperCase )
    {
        throw new IllegalArgumentException( "either toUpperCase or toLowerCase can be set, but not both." );
    }
}
 
开发者ID:mojohaus,项目名称:build-helper-maven-plugin,代码行数:23,代码来源:RegexPropertySetting.java

示例5: checkPropValueNotBlank

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * Checks that the property is not null or empty string
 *
 * @param propValue value of the property from the project.
 * @throws EnforcerRuleException
 */
void checkPropValueNotBlank( Object propValue ) throws EnforcerRuleException
{

    if ( propValue == null || StringUtils.isBlank( propValue.toString() ) )
    {
        throw new EnforcerRuleException( String.format(
                "Property '%s' is required for this build and not defined in hierarchy at all.", property ) );
    }
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:16,代码来源:RequirePropertyDiverges.java

示例6: attachGeneratedIncludeFilesAsIncZip

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
private void attachGeneratedIncludeFilesAsIncZip()
    throws MojoExecutionException
{
    try
    {
        ZipArchiver archiver = new ZipArchiver();
        DefaultFileSet fileSet = new DefaultFileSet();
        fileSet.setUsingDefaultExcludes( true );
        fileSet.setDirectory( javahOutputDirectory );
        archiver.addFileSet( fileSet );
        archiver.setDestFile( this.incZipFile );
        archiver.createArchive();

        if ( StringUtils.isBlank( this.classifier ) )
        {
            projectHelper.attachArtifact( this.project, INCZIP_TYPE, null, this.incZipFile );
        }
        else
        {
            projectHelper.attachArtifact( this.project, INCZIP_TYPE, this.classifier, this.incZipFile );
        }
    }
    catch ( Exception e )
    {
        throw new MojoExecutionException( "Unable to archive/deploy generated include files", e );
    }
}
 
开发者ID:mojohaus,项目名称:maven-native,代码行数:28,代码来源:NativeJavahMojo.java

示例7: validateMojoParameters

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
@Override
protected String validateMojoParameters() {
  if (StringUtils.isBlank(this.sequence)) {
    return "sequence must not be empty.";
  }

  return null;
}
 
开发者ID:ferstl,项目名称:jitwatch-jarscan-maven-plugin,代码行数:9,代码来源:SequenceSearchMojo.java

示例8: InnerResourcesFormattingValidator

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
public InnerResourcesFormattingValidator(L10nValidatorLogger logger, String innerResourceRegex) {
  super(logger);
  if (StringUtils.isBlank(innerResourceRegex)) {
    formatter = null;
  }
  else {
    formatter = new InnerResourcesFormatter(innerResourceRegex);
  }
}
 
开发者ID:rquinio,项目名称:l10n-maven-plugin,代码行数:10,代码来源:InnerResourcesFormattingValidator.java

示例9: setContentDispositionAttachment

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * Set the content disposition type to attachment. This will instruct the browser downloading the file to save it
 * instead of displaying it inline (for example html files). <p/>
 * We don't set the name here and let the browser decide based on download URL.
 * For more info read <a href="https://www.ietf.org/rfc/rfc2183.txt">RFC2183</a>
 */
@Override
public void setContentDispositionAttachment(String filename) {
    if (ConstantValues.responseDisableContentDispositionFilename.getBoolean() || StringUtils.isBlank(filename)) {
        response.setHeader("Content-Disposition", "attachment");
    } else {
        response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\"" +
                "; filename*=UTF-8''" + HttpUtils.encodeQuery(filename));
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:16,代码来源:HttpArtifactoryResponse.java

示例10: setContentDispositionAttachment

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
@Override
public void setContentDispositionAttachment(String filename) {
    if (ConstantValues.responseDisableContentDispositionFilename.getBoolean() || StringUtils.isBlank(filename)) {
        response.header("Content-Disposition", "attachment");
    } else {
        response.header("Content-Disposition", "attachment; filename=\"" + filename + "\"");
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:9,代码来源:JerseyArtifactoryResponse.java

示例11: getEvn

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
private String getEvn() {
    String env = System.getProperty(ENV_KEY);
    if (StringUtils.isBlank(env)) {
        return DEFAULT_ENV;
    }
    return env;
}
 
开发者ID:liyebing,项目名称:easyprofile-maven-plugin,代码行数:8,代码来源:ProfileMojo.java

示例12: validate

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
void validate()
{
    if ( StringUtils.isBlank( name ) )
    {
        throw new IllegalArgumentException( "name required" );
    }

    if ( StringUtils.isBlank( value ) )
    {
        throw new IllegalArgumentException( "value required" );
    }

    if ( StringUtils.equals( value, elseValue ) )
    {
        throw new IllegalArgumentException( "value and else cannot be the same" );
    }

    if ( fileSet == null )
    {
        throw new IllegalArgumentException( "fileSet required" );
    }

    if ( StringUtils.isBlank( fileSet.getDirectory() ) )
    {
        throw new IllegalArgumentException( "directory required for " + fileSet );
    }

    if ( fileSet.getMapper() == null )
    {
        throw new IllegalArgumentException( "mapper required for " + fileSet );
    }
}
 
开发者ID:mojohaus,项目名称:build-helper-maven-plugin,代码行数:33,代码来源:UpToDatePropertySetting.java

示例13: createProject

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * Creates the custom project structure at the specified location and name
 * The Project will have below natures:<br>
 * <b>Java</b> and Custom nature as per <b>ETL</b> project
 * @param projectName Project name
 * @param location Where should the project be saved
 * @return
 */
public IProject createProject(String projectName, URI location){
	if (StringUtils.isNotBlank(projectName) && projectName.contains(" ")){
		MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
		messageBox.setText("Error");
		messageBox.setMessage("The Project Name has spaces");
		if(messageBox.open()==SWT.OK)
		{
			return null;
		}
	}
	else if(StringUtils.isBlank(projectName)){
		throw new InvalidProjectNameException();
	}
	IProject project = null;
	try {
		project = createBaseProject(projectName, location);
		if(project!=null)
		{
			addNature(project);
			addToProjectStructure(project, paths);
			IJavaProject javaProject = JavaCore.create(project);

			IFolder binFolder = project.getFolder(CustomMessages.ProjectSupport_BIN);
			javaProject.setOutputLocation(binFolder.getFullPath(), null);

			List<IClasspathEntry> entries = addJavaLibrariesInClassPath();

			IFolder libFolder = project.getFolder(CustomMessages.ProjectSupport_LIB);

			//add libs to project class path 
			String installLocation = Platform.getInstallLocation().getURL().getPath();

			//copyExternalLibAndAddToClassPath(installLocation + CustomMessages.ProjectSupport_LIB, libFolder, entries);

			copyBuildFile(installLocation + CustomMessages.ProjectSupport_CONFIG_FOLDER + "/" + 
					CustomMessages.ProjectSupport_GRADLE + "/" + BUILD, project);
			
			copyBuildFile(installLocation + CustomMessages.ProjectSupport_CONFIG_FOLDER + "/" + 
					CustomMessages.ProjectSupport_GRADLE + "/" + PROPERTIES, project);
			
			copyBuildFile(installLocation + CustomMessages.ProjectSupport_CONFIG_FOLDER + "/" + 
					MAVEN, project);
			
			updateMavenFile(POM_XML, project);
			
			javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);

			//set source folder entry in classpath
			javaProject.setRawClasspath(setSourceFolderInClassPath(project, javaProject), null);
		}
	} catch (CoreException e) {
		logger.debug("Failed to create Project with parameters as projectName : {} location : {}, exception : {}", 
				new Object[]{projectName, location, e});
		project = null;
	}

	return project;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:67,代码来源:ProjectStructureCreator.java

示例14: execute

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
public void execute( EnforcerRuleHelper helper )
    throws EnforcerRuleException
{
    try
    {
        if ( StringUtils.isBlank( encoding ) )
        {
            encoding = (String) helper.evaluate( "${project.build.sourceEncoding}" );
        }
        Log log = helper.getLog();
        if ( encoding.equals( StandardCharsets.US_ASCII.name() ) )
        {
            log.warn( "Encoding US-ASCII is hard to detect. Use UTF-8 or ISO-8859-1" );
        }
        String basedir = (String) helper.evaluate( "${basedir}" );
        DirectoryScanner ds = new DirectoryScanner();
        ds.setBasedir( basedir );
        if ( StringUtils.isNotBlank( includes ) )
        {
            ds.setIncludes( includes.split( "[,\\|]" ) );
        }
        if ( StringUtils.isNotBlank( excludes ) )
        {
            ds.setExcludes( excludes.split( "[,\\|]" ) );
        }
        if ( useDefaultExcludes )
        {
            ds.addDefaultExcludes();
        }
        ds.scan();
        StringBuilder filesInMsg = new StringBuilder();
        for ( String file : ds.getIncludedFiles() )
        {
            String fileEncoding = getEncoding( encoding, new File( basedir, file ), log );
            if ( log.isDebugEnabled() )
            {
                log.debug( file + "==>" + fileEncoding );
            }
            if ( fileEncoding != null && !fileEncoding.equals( encoding ) )
            {
                filesInMsg.append( file );
                filesInMsg.append( "==>" );
                filesInMsg.append( fileEncoding );
                filesInMsg.append( "\n" );
                if ( failFast )
                {
                    throw new EnforcerRuleException( filesInMsg.toString() );
                }
            }
        }
        if ( filesInMsg.length() > 0 )
        {
            throw new EnforcerRuleException( "Files not encoded in " + encoding + ":\n" + filesInMsg );
        }
    }
    catch ( IOException ex )
    {
        throw new EnforcerRuleException( "Reading Files", ex );
    }
    catch ( ExpressionEvaluationException e )
    {
        throw new EnforcerRuleException( "Unable to lookup an expression " + e.getLocalizedMessage(), e );
    }
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:65,代码来源:RequireEncoding.java

示例15: createLinkerCommandLine

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
protected Commandline createLinkerCommandLine( List objectFiles, LinkerConfiguration config )
{
    Commandline cl = new Commandline();

    cl.setWorkingDirectory( config.getWorkingDirectory().getPath() );

    String executable = EXECUTABLE;

    if ( !StringUtils.isBlank( config.getExecutable() ) )
    {
        executable = config.getExecutable();
    }

    cl.setExecutable( executable );

    for ( int i = 0; i < config.getStartOptions().length; ++i )
    {
        cl.createArg().setValue( config.getStartOptions()[i] );
    }

    // the next 2 are for completeness, the start options should be good enough
    for ( int i = 0; i < config.getMiddleOptions().length; ++i )
    {
        cl.createArg().setValue( config.getMiddleOptions()[i] );
    }

    for ( int i = 0; i < config.getEndOptions().length; ++i )
    {
        cl.createArg().setValue( config.getEndOptions()[i] );
    }

    cl.createArg().setFile( config.getOutputFile() );

    for ( int i = 0; i < objectFiles.size(); ++i )
    {
        File objFile = (File) objectFiles.get( i );

        cl.createArg().setValue( objFile.getPath() );
    }

    return cl;

}
 
开发者ID:mojohaus,项目名称:maven-native,代码行数:44,代码来源:ArchiveLinker.java


注:本文中的org.codehaus.plexus.util.StringUtils.isBlank方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。