本文整理汇总了Java中org.apache.commons.lang.StringUtils.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.EMPTY属性的具体用法?Java StringUtils.EMPTY怎么用?Java StringUtils.EMPTY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.lang.StringUtils
的用法示例。
在下文中一共展示了StringUtils.EMPTY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResultString
/**
* 取得结果字符串
*
* @param result
* @return
*/
protected String getResultString(Object result) {
if (result == null) {
return StringUtils.EMPTY;
}
if (result instanceof Map) { // 处理map
return getMapResultString((Map) result);
} else if (result instanceof List) {// 处理list
return getListResultString((List) result);
} else if (result.getClass().isArray()) {// 处理array
return getArrayResultString((Object[]) result);
} else {
// 直接处理string
return ObjectUtils.toString(result, StringUtils.EMPTY).toString();
// return ToStringBuilder.reflectionToString(result, ToStringStyle.SIMPLE_STYLE);
}
}
示例2: setErrorResponse
/**
* Sets response if an error occurs.
*
* @param request The request object.
* @param response The response object.
*/
private void setErrorResponse(SugarRestRequest request, SugarRestResponse response) {
ObjectMapper mapper = JsonObjectMapper.getMapper();
String jsonRequest = StringUtils.EMPTY;
String jsonResponse = StringUtils.EMPTY;
try {
jsonRequest = mapper.writeValueAsString(request);
jsonResponse = mapper.writeValueAsString(response);
} catch (JsonProcessingException exception) {
ErrorResponse errorResponse = ErrorResponse.format(exception, exception.getMessage());
errorResponse.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
response.setError(errorResponse);
}
response.setData(null);
response.setJData(StringUtils.EMPTY);
response.setJsonRawRequest(jsonRequest);
response.setJsonRawResponse(jsonResponse);
}
示例3: getEmail
public String getEmail(String dsSchemaName) {
String email = StringUtils.EMPTY;
HeartBeatVo hbConf = HeartBeatConfigContainer.getInstance().getHbConf();
String adminUseEmail = hbConf.getAdminUseEmail();
if (StringUtils.equals(adminUseEmail.toUpperCase(), "Y")) {
email = hbConf.getAdminEmail();
}
if (StringUtils.isNotBlank(dsSchemaName)) {
Map<String, Map<String, String>> additionalNotify = hbConf.getAdditionalNotify();
Map<String, String> map = additionalNotify.get(dsSchemaName);
if (map != null && StringUtils.equals(map.get("UseEmail").toUpperCase(), "Y")) {
if (StringUtils.isNotBlank(email)) {
email = StringUtils.join(new String[]{email, map.get("Email")}, ",");
} else {
email = map.get("Email");
}
}
}
return email;
}
示例4: contents
/**
*
* @Title: contents
* @Description: get file contents
* @param @return
* @return String
* @throws
*/
public static String contents(String filename)
{
String content = StringUtils.EMPTY;
try
{
InputStream is = FormatUtil.getInputStream(filename);
content = IOUtils.toString(is, Charsets.UTF_8.getCname());
FormatUtil.close(is);
}
catch(IOException e)
{
FormatView.getView().getStat().setText("Failed to read file: " + e.getMessage());
}
return content;
}
示例5: init
private void init() {
databaseClass = DEFAULT_DATABASE_CLASS;
url = DETAULT_URL;
driverClass = DEFAULT_H2_DRIVER;
username = StringUtils.EMPTY;
password = StringUtils.EMPTY;
embeddedPort = DEFAULT_EMBEDDED_PORT;
maxPool = DEFAULT_MAX_POOL;
minPool = DEFAULT_MIN_POOL;
initialPool = DEFAULT_INITIAL_POOL;
maxIdleTime = DEFAULT_MAX_IDLE_TIME;
maxStatementsPerConnection = DEFAULT_MAX_STATEMENTS_PER_CONNECTION;
showCommands = false;
testConnection = true;
}
示例6: explore
@Override
public void explore(List<AlarmRule> rules) {
if (CollectionUtils.isEmpty(rules)) {
return;
}
Long pipelineId = rules.get(0).getPipelineId();
List<ProcessStat> processStats = processStatService.listRealtimeProcessStat(pipelineId);
if (CollectionUtils.isEmpty(processStats)) {
return;
}
long now = System.currentTimeMillis();
Map<Long, Long> processTime = new HashMap<Long, Long>();
for (ProcessStat processStat : processStats) {
Long timeout = 0L;
if (!CollectionUtils.isEmpty(processStat.getStageStats())) {
timeout = now - processStat.getStageStats().get(0).getStartTime();
}
processTime.put(processStat.getProcessId(), timeout);
}
String message = StringUtils.EMPTY;
for (AlarmRule rule : rules) {
if (message.isEmpty()) {
message = checkTimeout(rule, processTime);
} else {
checkTimeout(rule, processTime);
}
}
if (!message.isEmpty()) {
logRecordAlarm(pipelineId, MonitorName.PROCESSTIMEOUT, message);
}
}
示例7: getDebugFlag
protected String getDebugFlag(CmsWorkOrderSimpleBase ao) {
String debugFlag = StringUtils.EMPTY;
if (isDebugEnabled(ao)) {
debugFlag = "-d";
}
return debugFlag;
}
示例8: findFirst
public static String findFirst(String originalStr, String regex) {
if (StringUtils.isBlank(originalStr) || StringUtils.isBlank(regex)) {
return StringUtils.EMPTY;
}
PatternMatcher matcher = new Perl5Matcher();
if (matcher.contains(originalStr, patterns.get(regex))) {
return StringUtils.trimToEmpty(matcher.getMatch().group(0));
}
return StringUtils.EMPTY;
}
示例9: format
/**
*
* @Title: format
* @Description: Format text
* @param @param txt
* @param @return
* @return String
* @throws
*/
public static String format(String txt)
{
if (StringUtils.isBlank(txt))
{
return StringUtils.EMPTY;
}
try
{
if (isJson(txt))
{
return prettyJson(txt);
}
if (isHtml(txt))
{
return prettyHtml(txt);
}
if (isXml(txt))
{
return prettyXml(txt);
}
}
catch(Throwable e)
{
FormatView.getView().getStat().setText("Failed to format text: " + e.getMessage());
}
return txt;
}
示例10: deleteGroupAccountTest
@Test
public void deleteGroupAccountTest() {
SugarRestRequest request = new SugarRestRequest("Accounts", RequestType.BulkRead);
request.setUrl(TestAccount.Url);
request.setUsername(TestAccount.Username);
request.setPassword(TestAccount.Password);
List<QueryPredicate> queryPredicates = new ArrayList<QueryPredicate>();
// Since query is set, the query predicates will be ignored.
queryPredicates.add(new QueryPredicate("name", Contains, "SugarOnRest"));
request.getOptions().setQueryPredicates(queryPredicates);
SugarRestClient client = new SugarRestClient();
SugarRestResponse response = client.execute(request);
assertNotNull(response);
assertEquals(response.getStatusCode(), HttpStatus.SC_OK);
List<Accounts> accounts = (List<Accounts>)response.getData();
if (accounts != null){
for (Accounts account : accounts) {
// -------------------Delete Account-------------------
response = AccountsModule.deleteAccount(client, account.getId());
assertNotNull(response);
assertEquals(response.getStatusCode(), HttpStatus.SC_OK);
String deleteId = (response.getData() == null) ? StringUtils.EMPTY : response.getData().toString();
assertNotNull(deleteId);
assertNotSame(deleteId, StringUtils.EMPTY );
assertEquals(account.getId(), deleteId);
// -------------------End Delete Account-------------------
}
}
}
示例11: SugarRestRequest
/**
* Initializes a new instance of the SugarRestRequest class.
*
* @param moduleType The SugarCRM module name.
* @param requestType The request type.
*/
public SugarRestRequest(Type moduleType, RequestType requestType) {
this.setModuleType(moduleType);
this.setRequestType(requestType);
this.setOptions(new Options());
this.validationMessage = StringUtils.EMPTY;
}
示例12: bulkDeleteAccount
public static List<String> bulkDeleteAccount(SugarRestClient client, List<String> accountIds) {
SugarRestRequest request = new SugarRestRequest("Accounts", RequestType.Delete);
List<String> listId = new ArrayList<String>();
for (String id : accountIds)
{
request.setParameter(id);
SugarRestResponse response = client.execute(request);
String identifier = (response.getData() == null) ? StringUtils.EMPTY : response.getData().toString();
listId.add(identifier);
}
return listId;
}
示例13: toAddressString
/**
* InetSocketAddress转 host:port 字符串
*
* @param address InetSocketAddress转
* @return host:port 字符串
*/
public static String toAddressString(InetSocketAddress address) {
if (address == null) {
return StringUtils.EMPTY;
} else {
return toIpString(address) + ":" + address.getPort();
}
}
示例14: getOrderType
/**
* Returns the string constants for the order types
*
* @param type 0-TRANSFER, 1- PURCHASE, 2-SALES
* @return try-TRANSFER, prc- PURCHASE,sle- SALES
*/
public static String getOrderType(Integer type) {
if (type == 0) {
return IOrder.TYPE_TRANSFER;
} else if (type == 1) {
return IOrder.TYPE_PURCHASE;
} else if (type == 2) {
return IOrder.TYPE_SALE;
}
return StringUtils.EMPTY;
}
示例15: columnDocumentation
/**
* @see org.alfasoftware.morf.excel.AdditionalSchemaData#columnDocumentation(Table, java.lang.String)
*/
@Override
public String columnDocumentation(Table table, String columnName) {
return StringUtils.EMPTY;
}