本文整理了Java中net.roboconf.core.utils.Utils.isEmptyOrWhitespaces()
方法的一些代码示例,展示了Utils.isEmptyOrWhitespaces()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.isEmptyOrWhitespaces()
方法的具体详情如下:
包路径:net.roboconf.core.utils.Utils
类名称:Utils
方法名:isEmptyOrWhitespaces
暂无
代码示例来源:origin: net.roboconf/roboconf-messaging-api
private String getAgentId() {
return Utils.isEmptyOrWhitespaces( this.scopedInstancePath ) ? "?" : this.scopedInstancePath;
}
}
代码示例来源:origin: roboconf/roboconf-platform
/**
* @param inlineComment the inlineComment to set
*/
public void setInlineComment( String inlineComment ) {
this.inlineComment = Utils.isEmptyOrWhitespaces( inlineComment ) ? null : inlineComment;
}
代码示例来源:origin: net.roboconf/roboconf-agent
/**
* @param ipAddress the ipAddress to set
*/
public void setIpAddress( String ipAddress ) {
if(! Utils.isEmptyOrWhitespaces(ipAddress)) {
this.ipAddress = ipAddress;
this.logger.finer( "New IP address set in the agent: " + ipAddress );
}
}
代码示例来源:origin: roboconf/roboconf-platform
@Override
protected void analyzeLine( String line ) {
if( ! Utils.isEmptyOrWhitespaces( line )
&& ! line.trim().startsWith( ParsingConstants.COMMENT_DELIMITER ))
this.uncommented ++;
}
代码示例来源:origin: net.roboconf/roboconf-agent
/**
* @return the agent's ID (a human-readable identifier)
*/
public String getAgentId() {
StringBuilder sb = new StringBuilder();
sb.append( Utils.isEmptyOrWhitespaces( this.scopedInstancePath ) ? "?" : this.scopedInstancePath );
if( ! Utils.isEmptyOrWhitespaces( this.applicationName ))
sb.append(" @ ").append( this.applicationName );
return sb.toString();
}
代码示例来源:origin: net.roboconf/roboconf-messaging-api
/**
* Removes unnecessary slashes and transforms the others into dots.
* @param instancePath an instance path
* @return a non-null string
*/
public static String escapeInstancePath( String instancePath ) {
String result;
if( Utils.isEmptyOrWhitespaces( instancePath ))
result = "";
else
result = instancePath.replaceFirst( "^/*", "" ).replaceFirst( "/*$", "" ).replaceAll( "/+", "." );
return result;
}
代码示例来源:origin: roboconf/roboconf-platform
/**
* Removes unnecessary slashes and transforms the others into dots.
* @param instancePath an instance path
* @return a non-null string
*/
public static String escapeInstancePath( String instancePath ) {
String result;
if( Utils.isEmptyOrWhitespaces( instancePath ))
result = "";
else
result = instancePath.replaceFirst( "^/*", "" ).replaceFirst( "/*$", "" ).replaceAll( "/+", "." );
return result;
}
代码示例来源:origin: roboconf/roboconf-platform
/**
* Capitalizes a string.
* @param s a string
* @return the capitalized string
*/
public static String capitalize( String s ) {
String result = s;
if( ! Utils.isEmptyOrWhitespaces( s ))
result = Character.toUpperCase( s.charAt( 0 )) + s.substring( 1 ).toLowerCase();
return result;
}
代码示例来源:origin: roboconf/roboconf-platform
@Override
public List<ParsingError> doValidate() {
List<ParsingError> result = new ArrayList<> ();
if( Utils.isEmptyOrWhitespaces( this.msg ))
result.add( error( ErrorCode.CMD_EMAIL_NO_MESSAGE ));
return result;
}
代码示例来源:origin: roboconf/roboconf-platform
/**
* @param line the raw line
* @param blocks the blocks to update
* @return {@link #P_CODE_YES} or {@link #P_CODE_NO}
*/
int recognizeBlankLine( String line, Collection<AbstractBlock> blocks ) {
int result = P_CODE_NO;
if( Utils.isEmptyOrWhitespaces( line )) {
result = P_CODE_YES;
blocks.add( new BlockBlank( this.definitionFile, line ));
}
return result;
}
代码示例来源:origin: roboconf/roboconf-platform
/**
* @param block a block
* @return a non-null list of {@link ParsingError}s
*/
public static Collection<ParsingError> validate( BlockImport block ) {
String uri = block.getUri();
Collection<ParsingError> result = new ArrayList<> ();
if( Utils.isEmptyOrWhitespaces( uri ))
result.add( parsingError( ErrorCode.PM_EMPTY_IMPORT_LOCATION, block ));
return result;
}
代码示例来源:origin: roboconf/roboconf-platform
/**
* @param block a block
* @return a non-null list of {@link ParsingError}s
*/
public static Collection<ParsingError> validate( BlockBlank block ) {
// Only makes sense when a BlockBlank section was created programmatically.
Collection<ParsingError> result = new ArrayList<> ();
if( ! Utils.isEmptyOrWhitespaces( block.getContent()))
result.add( parsingError( ErrorCode.PM_MALFORMED_BLANK, block ));
return result;
}
代码示例来源:origin: roboconf/roboconf-platform
@Override
public List<ParsingError> doValidate() {
List<ParsingError> result = new ArrayList<> ();
if( Utils.isEmptyOrWhitespaces( this.filePath ))
result.add( new ParsingError( ErrorCode.CMD_MISSING_TARGET_FILE, this.context.getCommandFile(), this.line ));
return result;
}
代码示例来源:origin: net.roboconf/roboconf-messaging-api
@Override
public int hashCode() {
String topicName = getTopicName();
int backup = this.kind.hashCode();
return Utils.isEmptyOrWhitespaces( topicName ) ? backup : topicName.hashCode();
}
代码示例来源:origin: roboconf/roboconf-platform
@Override
public int hashCode() {
String topicName = getTopicName();
int backup = this.kind.hashCode();
return Utils.isEmptyOrWhitespaces( topicName ) ? backup : topicName.hashCode();
}
代码示例来源:origin: net.roboconf/roboconf-dm-rest-api
@Override
public ContainerResponse filter( ContainerRequest req, ContainerResponse contResp ) {
ResponseBuilder resp = Response.fromResponse( contResp.getResponse());
resp
.header( "Access-Control-Allow-Origin", "*" )
.header( "Access-Control-Allow-Methods", "GET, DELETE, POST, OPTIONS" );
String reqHead = req.getHeaderValue( "Access-Control-Request-Headers" );
if( ! Utils.isEmptyOrWhitespaces( reqHead ))
resp.header( "Access-Control-Allow-Headers", reqHead );
contResp.setResponse( resp.build());
return contResp;
}
}
代码示例来源:origin: roboconf/roboconf-platform
@Override
public List<ParsingError> doValidate() {
List<ParsingError> result = new ArrayList<> ();
if( Utils.isEmptyOrWhitespaces( this.newInstanceName ))
result.add( error( ErrorCode.CMD_MISSING_INSTANCE_NAME ));
else if( ! this.newInstanceName.matches( ParsingConstants.PATTERN_FLEX_ID ))
result.add( error( ErrorCode.CMD_INVALID_INSTANCE_NAME ));
if( ! this.context.instanceExists( this.replicatedInstancePath ))
result.add( error( ErrorCode.CMD_NO_MATCHING_INSTANCE, instance( this.replicatedInstancePath )));
else if( InstanceHelpers.countInstances( this.replicatedInstancePath ) > 1 )
result.add( error( ErrorCode.CMD_NOT_A_ROOT_INSTANCE, instance( this.replicatedInstancePath )));
return result;
}
代码示例来源:origin: net.roboconf/roboconf-iaas-vmware
private VirtualMachine getVirtualMachine(String virtualmachineName) throws RemoteException {
if( Utils.isEmptyOrWhitespaces( virtualmachineName ))
return null;
Folder rootFolder = this.vmwareServiceInstance.getRootFolder();
return (VirtualMachine) new InventoryNavigator(rootFolder).searchManagedEntity("VirtualMachine", virtualmachineName);
}
代码示例来源:origin: roboconf/roboconf-platform
@Override
public List<ParsingError> doValidate() {
List<ParsingError> result = new ArrayList<> ();
if( Utils.isEmptyOrWhitespaces( this.targetId ))
result.add( error( ErrorCode.CMD_INVALID_TARGET_ID, value( this.targetId )));
Instance resolvedInstance;
if(( resolvedInstance = this.context.resolveInstance( this.scopedInstancePath )) == null)
result.add( error( ErrorCode.CMD_NO_MATCHING_INSTANCE, instance( this.scopedInstancePath )));
else if( ! InstanceHelpers.isTarget( resolvedInstance ))
result.add( error( ErrorCode.CMD_NOT_A_SCOPED_INSTANCE ));
return result;
}
代码示例来源:origin: roboconf/roboconf-platform
@Test
public void testIsEmptyOrWhitespaces() {
Assert.assertTrue( Utils.isEmptyOrWhitespaces( null ));
Assert.assertTrue( Utils.isEmptyOrWhitespaces( "" ));
Assert.assertTrue( Utils.isEmptyOrWhitespaces( " " ));
Assert.assertTrue( Utils.isEmptyOrWhitespaces( " \n \t" ));
Assert.assertFalse( Utils.isEmptyOrWhitespaces( " a\n \t" ));
Assert.assertFalse( Utils.isEmptyOrWhitespaces( "b" ));
}
内容来源于网络,如有侵权,请联系作者删除!