本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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() ) ) );
}
示例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 );
}
}
}
示例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;
}
示例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;
}
示例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 );
}
}
示例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;
}
示例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;
}