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


Java StringUtils.replace方法代码示例

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


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

示例1: normalizePattern

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
private static String normalizePattern(String pattern) {
  pattern = pattern.trim();

  if (pattern.startsWith(SelectorUtils.REGEX_HANDLER_PREFIX)) {
    if (File.separatorChar == '\\') {
      pattern = StringUtils.replace(pattern, "/", "\\\\");
    }
    else {
      pattern = StringUtils.replace(pattern, "\\\\", "/");
    }
  }
  else {
    pattern = pattern.replace(File.separatorChar == '/' ? '\\' : '/', File.separatorChar);

    if (pattern.endsWith(File.separator)) {
      pattern += "**";
    }
  }

  return pattern;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:MavenResourceFileFilter.java

示例2: developerAccessStarteam

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * Create the documentation to provide an developer access with a
 * <code>Starteam</code> SCM. For example, generate the following command
 * line:
 * <p>
 * stcmd co -x -nologo -stop -p myusername:[email protected]:1234/projecturl
 * -is
 * </p>
 * <p>
 * stcmd ci -x -nologo -stop -p myusername:[email protected]:1234/projecturl
 * -f NCI -is
 * </p>
 *
 * @param starteamRepo
 */
private void developerAccessStarteam(StarteamScmProviderRepository starteamRepo) {
    paragraph(getI18nString("devaccess.starteam.intro"));

    StringBuilder command = new StringBuilder();

    // Safety: remove the username/password if present
    String fullUrl = StringUtils.replace(starteamRepo.getFullUrl(), starteamRepo.getUser(), "username");
    fullUrl = StringUtils.replace(fullUrl, starteamRepo.getPassword(), "password");

    command.append("$ stcmd co -x -nologo -stop -p ");
    command.append(fullUrl);
    command.append(" -is");
    command.append(SystemUtils.LINE_SEPARATOR);
    command.append("$ stcmd ci -x -nologo -stop -p ");
    command.append(fullUrl);
    command.append(" -f NCI -is");

    verbatimText(command.toString());
}
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:35,代码来源:ScmRenderer.java

示例3: quoted

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
private static String quoted( Object obj )
{
    String arg = obj.toString();
    arg = StringUtils.replace( arg, "\\", "\\\\" );
    arg = StringUtils.replace( arg, "'", "\\'" );
    return "'" + arg + "'";
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:8,代码来源:JavadocMojo.java

示例4: createClassPath

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * Constructs AspectJ compiler classpath string
 *
 * @param project the Maven Project
 * @param pluginArtifacts the plugin Artifacts
 * @param outDirs the outputDirectories
 * @return a os spesific classpath string
 */
@SuppressWarnings( "unchecked" )
public static String createClassPath( MavenProject project, List<Artifact> pluginArtifacts, List<String> outDirs )
{
    String cp = new String();
    Set<Artifact> classPathElements = Collections.synchronizedSet( new LinkedHashSet<Artifact>() );
    Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts();
    classPathElements.addAll( dependencyArtifacts == null ? Collections.<Artifact>emptySet() : dependencyArtifacts );
    classPathElements.addAll( project.getArtifacts() );
    classPathElements.addAll( pluginArtifacts == null ? Collections.<Artifact>emptySet() : pluginArtifacts );
    for ( Artifact classPathElement  : classPathElements )
    {
        File artifact = classPathElement.getFile();
        if ( null != artifact )
        {
          String type = classPathElement.getType();
          if (!type.equals("pom")){
            cp += classPathElement.getFile().getAbsolutePath();
            cp += File.pathSeparatorChar;                
          }
        }
    }
    Iterator<String> outIter = outDirs.iterator();
    while ( outIter.hasNext() )
    {
        cp += outIter.next();
        cp += File.pathSeparatorChar;
    }

    if ( cp.endsWith( "" + File.pathSeparatorChar ) )
    {
        cp = cp.substring( 0, cp.length() - 1 );
    }

    cp = StringUtils.replace( cp, "//", "/" );
    return cp;
}
 
开发者ID:mojohaus,项目名称:aspectj-maven-plugin,代码行数:45,代码来源:AjcHelper.java

示例5: executeMkdirCommand

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * @see org.apache.maven.scm.command.mkdir.AbstractMkdirCommand#executeMkdirCommand(org.apache.maven.scm.provider.ScmProviderRepository, org.apache.maven.scm.ScmFileSet, java.lang.String)
 */
@Override
protected MkdirScmResult executeMkdirCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message,
                                              boolean createInLocal )
    throws ScmException
{
    SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repository;
    Iterator<File> it = fileSet.getFileList().iterator();
    String dirPath = it.next().getPath();
    // replacing \ with / for windauze
    if ( dirPath != null && Os.isFamily( Os.FAMILY_DOS ) )
    {
        dirPath = StringUtils.replace( dirPath, "\\", "/" );
    }
    String url = javaRepo.getUrl() + "/" + dirPath;
    if ( createInLocal )
    {
        url = dirPath;
    }
    List<SVNURL> svnurls = new ArrayList<SVNURL>( 1 );
    try
    {
        svnurls.add( SVNURL.parseURIEncoded( url ) );

        SVNCommitInfo commitInfo =
            SvnJavaUtil.mkdir( javaRepo.getClientManager(), svnurls.toArray( new SVNURL[svnurls.size()] ),
                               message );
        ScmResult scmResult = new ScmResult( null, null, null, true );

        return new MkdirScmResult( Long.toString( commitInfo.getNewRevision() ), scmResult );
    }
    catch ( SVNException e )
    {
        throw new ScmException( e.getMessage(), e );
    }
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:39,代码来源:SvnJavaMkdirCommand.java

示例6: getScmUrl

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
public static String getScmUrl( File repositoryRootFile )
    throws CommandLineException
{
    String repositoryRoot = repositoryRootFile.getAbsolutePath();

    // TODO: it'd be great to build this into CommandLineUtils somehow
    // TODO: some way without a custom cygwin sys property?
    if ( "true".equals( System.getProperty( "cygwin" ) ) )
    {
        Commandline cl = new Commandline();

        cl.setExecutable( "cygpath" );

        cl.createArg().setValue( "--unix" );

        cl.createArg().setValue( repositoryRoot );

        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
        
        int exitValue = CommandLineUtils.executeCommandLine( cl, stdout, null );

        if ( exitValue != 0 )
        {
            throw new CommandLineException( "Unable to convert cygwin path, exit code = " + exitValue );
        }

        repositoryRoot = stdout.getOutput().trim();
    }
    else if ( Os.isFamily( "windows" ) )
    {
        repositoryRoot = "/" + StringUtils.replace( repositoryRoot, "\\", "/" );
    }

    return "scm:javasvn:file://" + repositoryRoot;
}
 
开发者ID:olamy,项目名称:maven-scm-provider-svnjava,代码行数:36,代码来源:SvnJavaScmTestUtils.java

示例7: getCommandlineInfo

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected String getCommandlineInfo( Commandline commandLine )
{
    String commandLineInfo = super.getCommandlineInfo( commandLine );

    commandLineInfo = StringUtils.replace( commandLineInfo, this.keypass, "'*****'" );
    commandLineInfo = StringUtils.replace( commandLineInfo, this.newPassword, "'*****'" );

    return commandLineInfo;
}
 
开发者ID:mojohaus,项目名称:keytool,代码行数:14,代码来源:ChangeKeyPasswordMojo.java

示例8: getCommandlineInfo

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected String getCommandlineInfo( Commandline commandLine )
{
    String commandLineInfo = super.getCommandlineInfo( commandLine );

    commandLineInfo = StringUtils.replace( commandLineInfo, this.keypass, "'*****'" );

    return commandLineInfo;
}
 
开发者ID:mojohaus,项目名称:keytool,代码行数:13,代码来源:GenerateKeyPairMojo.java

示例9: getCommandlineInfo

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected String getCommandlineInfo( final Commandline commandLine )
{
    String commandLineInfo = super.getCommandlineInfo( commandLine );

    commandLineInfo = StringUtils.replace( commandLineInfo, this.storepass, "'*****'" );

    return commandLineInfo;
}
 
开发者ID:mojohaus,项目名称:keytool,代码行数:13,代码来源:AbstractKeyToolRequestWithKeyStoreParametersMojo.java

示例10: getCommandlineInfo

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected String getCommandlineInfo( Commandline commandLine )
{
    String commandLineInfo = super.getCommandlineInfo( commandLine );

    commandLineInfo = StringUtils.replace( commandLineInfo, this.srckeypass, "'*****'" );
    commandLineInfo = StringUtils.replace( commandLineInfo, this.destkeypass, "'*****'" );
    commandLineInfo = StringUtils.replace( commandLineInfo, this.srcstorepass, "'*****'" );
    commandLineInfo = StringUtils.replace( commandLineInfo, this.deststorepass, "'*****'" );

    return commandLineInfo;
}
 
开发者ID:mojohaus,项目名称:keytool,代码行数:16,代码来源:ImportKeystoreMojo.java

示例11: getCommandlineInfo

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected String getCommandlineInfo( Commandline commandLine )
{
    String commandLineInfo = super.getCommandlineInfo( commandLine );

    commandLineInfo = StringUtils.replace( commandLineInfo, this.newPassword, "'*****'" );

    return commandLineInfo;
}
 
开发者ID:mojohaus,项目名称:keytool,代码行数:13,代码来源:ChangeStorePasswordMojo.java

示例12: getFileName

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
private static String getFileName(File folder, File file) {
    String name = StringUtils.replace(file.getAbsolutePath(), folder.getAbsolutePath() + "/", "");
    return name;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:5,代码来源:ZipUtils.java

示例13: writePaths

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
private final void writePaths( PrintWriter out, Module[] modules, String[] keys )
    throws MojoExecutionException
{
    if ( modules == null || modules.length == 0 )
    {
        return;
    }
    String[] paths = new String[modules.length];
    for ( int i = 0; i < modules.length; i++ )
    {
        Module module = modules[i];
        // String key = ArtifactUtils.versionlessKey( module.getGroupId(), module.getArtifactId() );
        // Artifact artifact = (Artifact) project.getArtifactMap().get( key );
        Artifact artifact = null;
        @SuppressWarnings("unchecked") Set<Artifact> allArtifacts = project.getArtifacts();
        for ( Artifact art : allArtifacts )
        {
            if ( art.getGroupId().equals( module.getGroupId() )
                && art.getArtifactId().equals( module.getArtifactId() )
                && StringUtils.equals( module.getClassifier(), art.getClassifier() )
                && StringUtils.equals( module.getType(), module.getType() ) )
            {
                artifact = art;
                break;
            }

        }
        if ( artifact == null )
        {
            throw new MojoExecutionException( "The artifact " + module.toString()
                                                  + " referenced in aspectj plugin as an aspect library, is not found the project dependencies" );

        }
        paths[i] = artifact.getFile().getPath();
    }
    for ( int i = 1; i <= paths.length; i++ )
    {
        out.println( "org.eclipse.ajdt.ui.aspectPath.contentKind" + i + "=BINARY" );
    }
    for ( int i = 1; i <= paths.length; i++ )
    {
        out.println( "org.eclipse.ajdt.ui.aspectPath.entryKind" + i + "=LIBRARY" );
    }
    for ( int i = 0; i < paths.length; i++ )
    {
        out.print( "org.eclipse.ajdt.ui.aspectPath" + i + "=" );
        String path = paths[i];
        path = StringUtils.replace( path, "\\", "/" );
        path = StringUtils.replace( path, ":", "\\:" );
        out.println( path );
    }
}
 
开发者ID:mojohaus,项目名称:aspectj-maven-plugin,代码行数:53,代码来源:EclipseAjcMojo.java

示例14: developerAccessCVS

import org.codehaus.plexus.util.StringUtils; //导入方法依赖的package包/类
/**
 * Create the documentation to provide an developer access with a
 * <code>CVS</code> SCM. For example, generate the following command line:
 * <p>
 * cvs -d :pserver:[email protected]:/home/cvs login
 * </p>
 * <p>
 * cvs -z3 -d :ext:[email protected]:/home/cvs co maven-plugins/dist
 * </p>
 *
 * @param cvsRepo
 * @see <a
 *      href="https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115">https://www.cvshome.org/docs/manual/cvs-1.12.12/cvs_16.html#SEC115</a>
 */
// CHECKSTYLE_ON: LineLength
private void developerAccessCVS(CvsScmProviderRepository cvsRepo) {
    paragraph(getI18nString("devaccess.cvs.intro"));

    // Safety: remove the username if present
    String cvsRoot = StringUtils.replace(cvsRepo.getCvsRoot(), cvsRepo.getUser(), "username");

    verbatimText("$ cvs -d " + cvsRoot + " login" + SystemUtils.LINE_SEPARATOR + "$ cvs -z3 -d " + cvsRoot
            + " co " + cvsRepo.getModule());
}
 
开发者ID:bsorrentino,项目名称:maven-confluence-plugin,代码行数:25,代码来源:ScmRenderer.java


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