當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtils.equals方法代碼示例

本文整理匯總了Java中org.codehaus.plexus.util.StringUtils.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.equals方法的具體用法?Java StringUtils.equals怎麽用?Java StringUtils.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.codehaus.plexus.util.StringUtils的用法示例。


在下文中一共展示了StringUtils.equals方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findDependencyVersion

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Tries to find missing version from a list of dependencies. If found, the
 * artifact is updated with the correct version.
 * 
 * @param artifact
 *            representing configured file.
 * @param list
 *            list of dependencies to search.
 * @param looseMatch
 *            only look at artifactId and groupId
 * @return the found dependency
 */
private boolean findDependencyVersion( ArtifactItem artifact, List list, boolean looseMatch )
{
    boolean result = false;

    for ( int i = 0; i < list.size(); i++ )
    {
        Dependency dependency = (Dependency) list.get( i );
        if ( StringUtils.equals( dependency.getArtifactId(), artifact.getArtifactId() )
            && StringUtils.equals( dependency.getGroupId(), artifact.getGroupId() )
            && ( looseMatch || StringUtils.equals( dependency.getClassifier(), artifact.getClassifier() ) )
            && ( looseMatch || StringUtils.equals( dependency.getType(), artifact.getType() ) ) )
        {

            artifact.setVersion( dependency.getVersion() );

            result = true;
            break;
        }
    }

    return result;
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:35,代碼來源:AbstractFromConfigurationMojo.java

示例2: createBaseProject

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Creates the base structure of the project under specified location and name
 * @param projectName
 * @param location
 * @return
 * @throws CoreException 
 */
private IProject createBaseProject(String projectName, URI location) throws CoreException {
	IProject newProject=null;
	
	if(location==null){
			newProject = createTheProjectAtSpecifiedLocation(projectName,location);
	}
	else{
		IPath iPath	 = new Path(location.getPath());
		if (!StringUtils.equals(iPath.lastSegment(), projectName)) {
			iPath = iPath.append(projectName);
		}
		URI newLocation=URI.create(iPath.toFile().toURI().toString());
			newProject=	createTheProjectAtSpecifiedLocation(projectName, newLocation);
	}
	return newProject;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:24,代碼來源:ProjectStructureCreator.java

示例3: getCachedTargetFileName

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Returns the cached target file name that matches the specified dependency, that is the target file name of the
 * previous run.
 * <p/>
 * The dependency object may have changed so the comparison is based on basic attributes of the dependency.
 *
 * @param dependency a dependency
 * @return the target file name of the last run for this dependency
 */
public String getCachedTargetFileName( Dependency dependency )
{
    if ( cache == null )
    {
        return null;
    }
    for ( DependencyInfo dependencyInfo : cache.getDependenciesInfo() )
    {
        final Dependency dependency2 = dependencyInfo.getDependency();
        if ( StringUtils.equals( dependency.getGroupId(), dependency2.getGroupId() )
            && StringUtils.equals( dependency.getArtifactId(), dependency2.getArtifactId() )
            && StringUtils.equals( dependency.getType(), dependency2.getType() )
            && StringUtils.equals( dependency.getClassifier(), dependency2.getClassifier() ) )
        {

            return dependencyInfo.getTargetFileName();

        }
    }
    return null;
}
 
開發者ID:zhegexiaohuozi,項目名稱:maven-seimicrawler-plugin,代碼行數:31,代碼來源:WebappStructure.java

示例4: removerServer

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Remover server.
 *
 * @param hostId the host id
 * @return the server info
 */
public ServerInfo removerServer( final String hostId )
{
    if ( hostId != null && this.serverInfoMap.containsKey( hostId ) )
    {
        ServerInfo serverInfo = this.serverInfoMap.remove( hostId );
        if ( serverInfo != null && StringUtils.equals( hostId, serverInfo.getNodeId() ) )
        {
            logger.info( "In removerServer, removed host with hostId '{}' from cache.", hostId );
            return serverInfo;
        }
        else
        {
            logger.warn( "In removerServer, Server Info Map contains key with hostId '{}', "
                + "but contains a ServerInfo object with NodeId '{}'.", hostId, serverInfo.getNodeId() );
        }
    }
    else
    {
        logger.error( "In removerServer, host with hostId '{}' not found in cache.", hostId );
    }
    return null;
}
 
開發者ID:vmware,項目名稱:OHMS,代碼行數:29,代碼來源:HmsDataCache.java

示例5: setContext

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
public synchronized void setContext( String context )
{
    if ( StringUtils.equals( currentContext, context ) )
    {
        return;
    }
    if ( currentContext != null )
    {
        clearContext();
    }
    currentContext = context;
    currentContextReportedDebug = false;
    currentContextReportedInfo = false;
    currentContextReportedWarn = false;
    currentContextReportedError = false;
}
 
開發者ID:mojohaus,項目名稱:versions-maven-plugin,代碼行數:17,代碼來源:DelegatingContextualLog.java

示例6: removePluginManagment

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Returns a set of dependencies where the dependencies which are defined in the dependency management section have
 * been filtered out.
 *
 * @param plugins The set of dependencies.
 * @param pluginManagement The set of dependencies from the dependency management section.
 * @return A new set of dependencies which are from the set of dependencies but not from the set of dependency
 *         management dependencies.
 * @since 1.0-beta-1
 */
private static Set<Plugin> removePluginManagment( Set<Plugin> plugins, Set<Plugin> pluginManagement )
{
    Set<Plugin> result = new TreeSet<>( new PluginComparator() );
    for ( Plugin c : plugins )
    {
        boolean matched = false;
        for ( Plugin t : pluginManagement )
        {
            if ( StringUtils.equals( t.getGroupId(), c.getGroupId() )
                && StringUtils.equals( t.getArtifactId(), c.getArtifactId() ) )
            {
                matched = true;
                break;
            }
        }
        if ( !matched )
        {
            result.add( c );
        }
    }
    return result;
}
 
開發者ID:mojohaus,項目名稱:versions-maven-plugin,代碼行數:33,代碼來源:PluginUpdatesReport.java

示例7: removePluginManagment

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Returns a set of dependencies where the dependencies which are defined in the dependency management section have
 * been filtered out.
 *
 * @param plugins          The set of dependencies.
 * @param pluginManagement The set of dependencies from the dependency management section.
 * @return A new set of dependencies which are from the set of dependencies but not from the set of dependency
 *         management dependencies.
 * @since 1.0-beta-1
 */
private static Set<Plugin> removePluginManagment( Set<Plugin> plugins, Set<Plugin> pluginManagement )
{
    Set<Plugin> result = new TreeSet<Plugin>( new PluginComparator() );
    for ( Plugin c : plugins )
    {
        boolean matched = false;
        for ( Plugin t : pluginManagement )
        {
            if ( StringUtils.equals( t.getGroupId(), c.getGroupId() ) && StringUtils.equals( t.getArtifactId(),
                                                                                             c.getArtifactId() ) )
            {
                matched = true;
                break;
            }
        }
        if ( !matched )
        {
            result.add( c );
        }
    }
    return result;
}
 
開發者ID:petr-ujezdsky,項目名稱:versions-maven-plugin-svn-clone,代碼行數:33,代碼來源:PluginUpdatesReport.java

示例8: getDependencyId

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
private static String getDependencyId( Artifact artifact, boolean removeVersion )
{
    StringBuffer sb = new StringBuffer();

    sb.append( artifact.getArtifactId() );

    if ( StringUtils.isNotEmpty( artifact.getClassifier() ) )
    {
        sb.append( "-" );
        sb.append( artifact.getClassifier() );
    }

    if ( !removeVersion )
    {
        sb.append( "-" );
        sb.append( artifact.getVersion() );
        sb.append( "-" );
        sb.append( artifact.getType() );
    }
    else
    {
        // if the classifier and type are the same (sources), then don't
        // repeat.
        // avoids names like foo-sources-sources
        if ( !StringUtils.equals( artifact.getClassifier(), artifact.getType() ) )
        {
            sb.append( "-" );
            sb.append( artifact.getType() );
        }
    }
    return sb.toString();
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:33,代碼來源:DependencyUtil.java

示例9: compareOverlayWithArtifact

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Compare groupId && artifactId && type && classifier.
 *
 * @param overlay the overlay
 * @param artifact the artifact
 * @return boolean true if equals
 */
private boolean compareOverlayWithArtifact( Overlay overlay, Artifact artifact )
{
    return ( StringUtils.equals( overlay.getGroupId(), artifact.getGroupId() )
        && StringUtils.equals( overlay.getArtifactId(), artifact.getArtifactId() )
        && StringUtils.equals( overlay.getType(), artifact.getType() )
    // MWAR-241 Make sure to treat null and "" as equal when comparing the classifier
    && StringUtils.equals( StringUtils.defaultString( overlay.getClassifier() ),
                           StringUtils.defaultString( artifact.getClassifier() ) ) );
}
 
開發者ID:zhegexiaohuozi,項目名稱:maven-seimicrawler-plugin,代碼行數:17,代碼來源:OverlayManager.java

示例10: copyResources

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Copies webapp webResources from the specified directory.
 *
 * @param context the WAR packaging context to use
 * @param resource the resource to copy
 * @throws IOException if an error occurred while copying the resources
 * @throws MojoExecutionException if an error occurred while retrieving the filter properties
 */
public void copyResources( WarPackagingContext context, Resource resource )
    throws IOException, MojoExecutionException
{
    if ( !context.getWebappDirectory().exists() )
    {
        context.getLog().warn( "Not copying webapp webResources [" + resource.getDirectory()
                                   + "]: webapp directory [" + context.getWebappDirectory().getAbsolutePath()
                                   + "] does not exist!" );
    }

    context.getLog().info( "Copying webapp webResources [" + resource.getDirectory() + "] to ["
                               + context.getWebappDirectory().getAbsolutePath() + "]" );
    String[] fileNames = getFilesToCopy( resource );
    for ( String fileName : fileNames )
    {
        String targetFileName = fileName;
        if ( resource.getTargetPath() != null )
        {
            // TODO make sure this thing is 100% safe
            // MWAR-129 if targetPath is only a dot <targetPath>.</targetPath> or ./
            // and the Resource is in a part of the warSourceDirectory the file from sources will override this
            // that's we don't have to add the targetPath yep not nice but works
            if ( !StringUtils.equals( ".", resource.getTargetPath() )
                && !StringUtils.equals( "./", resource.getTargetPath() ) )
            {
                targetFileName = resource.getTargetPath() + File.separator + targetFileName;
            }
        }
        if ( resource.isFiltering() && !context.isNonFilteredExtension( fileName ) )
        {
            copyFilteredFile( id, context, new File( resource.getDirectory(), fileName ), targetFileName );
        }
        else
        {
            copyFile( id, context, new File( resource.getDirectory(), fileName ), targetFileName );
        }
    }
}
 
開發者ID:zhegexiaohuozi,項目名稱:maven-seimicrawler-plugin,代碼行數:47,代碼來源:WarProjectPackagingTask.java

示例11: removeDependencyManagment

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Returns a set of dependencies where the dependencies which are defined in the dependency management section have
 * been filtered out.
 *
 * @param dependencies The set of dependencies.
 * @param dependencyManagement The set of dependencies from the dependency management section.
 * @return A new set of dependencies which are from the set of dependencies but not from the set of dependency
 *         management dependencies.
 * @since 1.0-beta-1
 */
private static Set removeDependencyManagment( Set<Dependency> dependencies, Set<Dependency> dependencyManagement )
{
    Set<Dependency> result = new TreeSet( new DependencyComparator() );
    for ( Iterator<Dependency> i = dependencies.iterator(); i.hasNext(); )
    {
        Dependency c = i.next();
        boolean matched = false;
        Iterator<Dependency> j = dependencyManagement.iterator();
        while ( !matched && j.hasNext() )
        {
            Dependency t = j.next();
            if ( StringUtils.equals( t.getGroupId(), c.getGroupId() )
                && StringUtils.equals( t.getArtifactId(), c.getArtifactId() )
                && ( t.getScope() == null || StringUtils.equals( t.getScope(), c.getScope() ) )
                && ( t.getClassifier() == null || StringUtils.equals( t.getClassifier(), c.getClassifier() ) )
                && ( c.getVersion() == null || t.getVersion() == null
                    || StringUtils.equals( t.getVersion(), c.getVersion() ) ) )
            {
                matched = true;
                break;
            }
        }
        if ( !matched )
        {
            result.add( c );
        }
    }
    return result;
}
 
開發者ID:mojohaus,項目名稱:versions-maven-plugin,代碼行數:40,代碼來源:DependencyUpdatesReport.java

示例12: removeDependencyManagment

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Returns a set of dependencies where the dependencies which are defined in the dependency management section have
 * been filtered out.
 *
 * @param dependencies The set of dependencies.
 * @param dependencyManagement The set of dependencies from the dependency management section.
 * @return A new set of dependencies which are from the set of dependencies but not from the set of dependency
 *         management dependencies.
 * @since 1.0-beta-1
 */
private static Set<Dependency> removeDependencyManagment( Set<Dependency> dependencies, Set<Dependency> dependencyManagement )
{
    Set<Dependency> result = new TreeSet<>( new DependencyComparator() );
    for ( Iterator<Dependency> i = dependencies.iterator(); i.hasNext(); )
    {
        Dependency c = i.next();
        boolean matched = false;
        Iterator<Dependency> j = dependencyManagement.iterator();
        while ( !matched && j.hasNext() )
        {
            Dependency t =j.next();
            if ( StringUtils.equals( t.getGroupId(), c.getGroupId() )
                && StringUtils.equals( t.getArtifactId(), c.getArtifactId() )
                && ( t.getScope() == null || StringUtils.equals( t.getScope(), c.getScope() ) )
                && ( t.getClassifier() == null || StringUtils.equals( t.getClassifier(), c.getClassifier() ) )
                && ( c.getVersion() == null || t.getVersion() == null
                    || StringUtils.equals( t.getVersion(), c.getVersion() ) ) )
            {
                matched = true;
                break;
            }
        }
        if ( !matched )
        {
            result.add( c );
        }
    }
    return result;
}
 
開發者ID:mojohaus,項目名稱:versions-maven-plugin,代碼行數:40,代碼來源:DisplayDependencyUpdatesMojo.java

示例13: 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

示例14: removeDependencyManagment

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * Returns a set of dependencies where the dependencies which are defined in the dependency management section have
 * been filtered out.
 *
 * @param dependencies         The set of dependencies.
 * @param dependencyManagement The set of dependencies from the dependency management section.
 * @return A new set of dependencies which are from the set of dependencies but not from the set of dependency
 *         management dependencies.
 * @since 1.0-beta-1
 */
private static Set removeDependencyManagment( Set dependencies, Set dependencyManagement )
{
    Set result = new TreeSet( new DependencyComparator() );
    for ( Iterator i = dependencies.iterator(); i.hasNext(); )
    {
        Dependency c = (Dependency) i.next();
        boolean matched = false;
        Iterator j = dependencyManagement.iterator();
        while ( !matched && j.hasNext() )
        {
            Dependency t = (Dependency) j.next();
            if ( StringUtils.equals( t.getGroupId(), c.getGroupId() ) &&
                StringUtils.equals( t.getArtifactId(), c.getArtifactId() ) &&
                ( t.getScope() == null || StringUtils.equals( t.getScope(), c.getScope() ) ) &&
                ( t.getClassifier() == null || StringUtils.equals( t.getClassifier(), c.getClassifier() ) ) &&
                ( c.getVersion() == null || t.getVersion() == null ||
                    StringUtils.equals( t.getVersion(), c.getVersion() ) ) )
            {
                matched = true;
                break;
            }
        }
        if ( !matched )
        {
            result.add( c );
        }
    }
    return result;
}
 
開發者ID:petr-ujezdsky,項目名稱:versions-maven-plugin-svn-clone,代碼行數:40,代碼來源:DependencyUpdatesReport.java

示例15: isRelated

import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
 * @param artifact {@link Artifact}
 * @param dependency {@link Dependency}
 * @return is related or not.
 */
public static boolean isRelated( Artifact artifact, Dependency dependency )
{
    if ( artifact == null || dependency == null )
    {
        return false;
    }

    if ( !StringUtils.equals( artifact.getGroupId(), dependency.getGroupId() ) )
    {
        return false;
    }
    if ( !StringUtils.equals( artifact.getArtifactId(), dependency.getArtifactId() ) )
    {
        return false;
    }
    if ( artifact.getVersion() != null ? !artifact.getVersion().equals( dependency.getVersion() )
                    : dependency.getVersion() != null )
    {
        return false;
    }
    if ( artifact.getType() != null ? !artifact.getType().equals( dependency.getType() )
                    : dependency.getType() != null )
    {
        return false;
    }
    if ( artifact.getClassifier() != null ? !artifact.getClassifier().equals( dependency.getClassifier() )
                    : dependency.getClassifier() != null )
    {
        return false;
    }
    if ( artifact.getScope() != null ? !artifact.getScope().equals( dependency.getScope() )
                    : dependency.getScope() != null )
    {
        return false;
    }
    if ( artifact.isOptional() != dependency.isOptional() )
    {
        return false;
    }

    return true;
}
 
開發者ID:zhegexiaohuozi,項目名稱:maven-seimicrawler-plugin,代碼行數:48,代碼來源:WarUtils.java


注:本文中的org.codehaus.plexus.util.StringUtils.equals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。