本文整理匯總了Java中org.codehaus.plexus.util.StringUtils.isNotBlank方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtils.isNotBlank方法的具體用法?Java StringUtils.isNotBlank怎麽用?Java StringUtils.isNotBlank使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.codehaus.plexus.util.StringUtils
的用法示例。
在下文中一共展示了StringUtils.isNotBlank方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: convertToJvmSettingsWithDefaultHandling
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
private JvmSettings convertToJvmSettingsWithDefaultHandling( Program program )
{
JvmSettings jvmSettings = new JvmSettings();
if ( program.getJvmSettings() != null )
{
// Some kind of settings done on per program base so they take
// precendence.
jvmSettings = program.getJvmSettings();
}
else
{
// No settings in the program done so we use the default behaviour
if ( StringUtils.isNotBlank( this.extraJvmArguments ) )
{
jvmSettings.setExtraArguments( parseTokens( this.extraJvmArguments ) );
}
}
return jvmSettings;
}
示例2: getExtension
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
private String getExtension(File artifact, Gav gav) {
if (gav != null && StringUtils.isNotBlank(gav.getExtension())) {
return gav.getExtension();
}
// last resort, the extension of the file
String artifactFileName = artifact.getName().toLowerCase();
// tar.gz? and other "special" combinations
if (artifactFileName.endsWith("tar.gz")) {
return "tar.gz";
} else if (artifactFileName.equals("tar.bz2")) {
return "tar.bz2";
}
// get the part after the last dot
return FileUtils.getExtension(artifactFileName);
}
示例3: computeSubPackageName
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* If useSourceHierarchy is true and sourceDirectory is set, return a sub package name that reflects the
* relative position of the ramlFile to sourceDirectory. Otherwise return an empty string.
*
* @param ramlFile
* @return computed sub package name
*/
protected String computeSubPackageName(File ramlFile) {
String subName = "";
if (useSourceHierarchyInPackageName && sourceDirectory != null) {
Path rel = sourceDirectory.toPath().relativize(ramlFile.toPath());
if (rel != null && rel.getParent() != null) {
String parent = rel.getParent().toString();
String rpn = parent.replace(File.separator, ".");
if (StringUtils.isNotBlank(rpn)) {
subName = ".".concat(rpn);
}
}
}
return subName;
}
示例4: hasInnerResources
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
public boolean hasInnerResources(String message) {
boolean isParametric = false;
if (StringUtils.isNotBlank(message)) {
isParametric = innerResourcePresencePattern.matcher(message).matches();
}
return isParametric;
}
示例5: captureInnerResources
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
public List<String> captureInnerResources(String message) {
List<String> innerKeys = new LinkedList<String>();
if (StringUtils.isNotBlank(message)) {
Matcher matcher = innerResourcePattern.matcher(message);
while (matcher.find()) {
String innerKey = matcher.group(1);
if (StringUtils.isNotBlank(innerKey)) {
innerKeys.add(innerKey);
}
}
}
return innerKeys;
}
示例6: getVersion
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
@Override
public String getVersion( MavenProject mavenProject )
throws ExternalVersionException
{
String newVersion = System.getProperty( EXTERNAL_VERSION, mavenProject.getVersion() );
String qualifier = StringUtils.trim( System.getProperty( EXTERNAL_VERSION_QUALIFIER ) );
if ( StringUtils.isNotBlank( qualifier ) )
{
// TODO: this needs to be cleaned up, the calling method will re-add the -SNAPSHOT if needed, but this is dirty
newVersion = newVersion.replaceFirst( "-SNAPSHOT", "" ) + "-" + qualifier;
}
return newVersion;
}
示例7: setFilename
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
@Override
public void setFilename(String filename) {
if (StringUtils.isNotBlank(filename)) {
response.setHeader(ArtifactoryRequest.FILE_NAME, HttpUtils.encodeQuery(filename));
} else {
log.debug("Could not register a null filename with the response.");
}
}
示例8: setFilename
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
@Override
public void setFilename(String filename) {
if (StringUtils.isNotBlank(filename)) {
response.header(ArtifactoryRequest.FILE_NAME, HttpUtils.encodeQuery(filename));
} else {
log.debug("Could not register a null filename with the response.");
}
}
示例9: 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;
}
示例10: 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 );
}
}
示例11: executeThrift
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
/**
* Call {@link #executeOperation(Cassandra.Client)} on the provided operation
* @throws MojoExecutionException
* @throws MojoFailureException
*/
public static void executeThrift(ThriftApiOperation thriftApiOperation) throws MojoExecutionException
{
TSocket socket = new TSocket(thriftApiOperation.getRpcAddress(), thriftApiOperation.getRpcPort());
TTransport transport = new TFramedTransport(socket);
TBinaryProtocol binaryProtocol = new TBinaryProtocol(transport, true, true);
Cassandra.Client cassandraClient = new Cassandra.Client(binaryProtocol);
try
{
transport.open();
if ( StringUtils.isNotBlank(thriftApiOperation.getKeyspace()) )
{
cassandraClient.set_keyspace(thriftApiOperation.getKeyspace());
}
cassandraClient.set_cql_version(thriftApiOperation.getCqlVersion());
thriftApiOperation.executeOperation(cassandraClient);
} catch (ThriftApiExecutionException taee)
{
throw new MojoExecutionException("API Exception calling Apache Cassandra", taee);
} catch (Exception ex)
{
throw new MojoExecutionException("General exception from Thrift", ex);
}
finally
{
if ( transport != null && transport.isOpen() )
{
try
{
transport.flush();
transport.close();
} catch (Exception e)
{
throw new MojoExecutionException("Something went wrong cleaning up", e);
}
}
}
}
示例12: getCodeEnumValue
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
public String getCodeEnumValue() {
String retVal = myDisplay;
if (StringUtils.isBlank(retVal)) {
retVal = myCode;
if (Character.isDigit(myCode.charAt(0))) {
if (StringUtils.isNotBlank(myDefinition)) {
if (myDefinition.length() < 100) {
String newValue = myDefinition;
if (newValue.contains(",")) {
newValue = newValue.substring(0, newValue.indexOf(','));
}
if (newValue.contains("(")) {
newValue = newValue.substring(0, newValue.indexOf('('));
}
newValue = newValue.replace(" / ", " OR ");
while (!Character.isLetterOrDigit(newValue.charAt(newValue.length() - 1))) {
newValue = newValue.substring(0, newValue.length() - 1);
}
ourLog.info("[{}] Replacing numeric code {} with description: {}", new Object[] { myName, retVal, newValue });
retVal = newValue;
}
}
}
}
if ("=".equals(retVal)) {
retVal = "EQUALS";
}
if ("<=".equals(retVal)) {
retVal = "LESSTHAN_OR_EQUALS";
}
if ("<".equals(retVal)) {
retVal = "LESSTHAN";
}
if (">=".equals(retVal)) {
retVal = "GREATERTHAN_OR_EQUALS";
}
if (">".equals(retVal)) {
retVal = "GREATERTHAN";
}
StringBuilder b = new StringBuilder();
for (char next : retVal.toUpperCase().replace("'", "").replace("(", "").replace(")", "").toCharArray()) {
if (Character.isJavaIdentifierPart(next)) {
b.append(next);
} else {
b.append("_");
}
}
retVal = b.toString();
if (!Character.isJavaIdentifierStart(retVal.charAt(0))) {
retVal = '_' + retVal;
}
return retVal;
}
示例13: isHasDefinition
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
public boolean isHasDefinition() {
return StringUtils.isNotBlank(myDefinition);
}
示例14: isHasDisplay
import org.codehaus.plexus.util.StringUtils; //導入方法依賴的package包/類
public boolean isHasDisplay() {
return StringUtils.isNotBlank(myDisplay);
}