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


Java StringUtils.isEmpty方法代碼示例

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


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

示例1: updatePlaylistMetadata

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
@Override
protected KalturaMetadata updatePlaylistMetadata(String playlistId, Map<String, String> newMetadata) {
    if (StringUtils.isEmpty(playlistId)) {
        throw new IllegalArgumentException("playlist id must be set");
    }
    if (newMetadata == null) {
        newMetadata = new LinkedHashMap<String, String>();
    }
    // get existing metadata for playlist
    Map<String, String> metadata = getPlaylistMetadataFields(playlistId).get(playlistId);
    // update metadata key => value pairs with new values
    metadata.putAll(newMetadata);
    String xml = createPlaylistXmlMetadataString(metadata);
    KalturaMetadata kalturaMetadata = new KalturaMetadata();
    kalturaMetadata.xml = xml;
    return kalturaMetadata;
}
 
開發者ID:ITYug,項目名稱:kaltura-ce-sakai-extension,代碼行數:18,代碼來源:KalturaAPIServiceStub.java

示例2: getPermissions

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public static ArrayList<String> getPermissions(int id) throws SQLException{
    PreparedStatement stmt = plugin.getDb().getConnection().prepareStatement("SELECT permissions FROM ranks WHERE id = "+id+" LIMIT 1");
    ResultSet set = stmt.executeQuery();
    set.next();
    String s = set.getString("permissions");
    String[] permissions = new String[(StringUtils.isEmpty(s)?1:StringUtils.length(s)+1)];
    if(StringUtils.isNotEmpty(s)){permissions = s.split("\\s+");}
    ArrayList<String> perms = new ArrayList<>();
    perms.addAll(Arrays.asList(permissions));
    return perms;
}
 
開發者ID:Warvale,項目名稱:Ace,代碼行數:12,代碼來源:RankManager.java

示例3: getDateOfRelease

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public Date getDateOfRelease() {
    if (StringUtils.isEmpty(releaseDate)) {
        return null;
    }
    try {
        return DateUtils.parseDate(this.releaseDate, new String[]{"yyyy-MM-dd"});
    } catch (ParseException e) {
        return null;
    }
}
 
開發者ID:zouzhirong,項目名稱:configx,代碼行數:11,代碼來源:ReleaseFormSearchForm.java

示例4: applyIdentifierModifications

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
 * 
 * @param pi
 * @return
 * @throws FatalIndexerException
 * @should trim identifier
 * @should apply replace rules
 * @should replace spaces with underscores
 * @should replace commas with underscores
 */
public static String applyIdentifierModifications(String pi) throws FatalIndexerException {
    if (StringUtils.isEmpty(pi)) {
        return pi;
    }
    String ret = pi.trim();
    // Apply replace rules defined for the field PI
    List<FieldConfig> configItems = Configuration.getInstance().getMetadataConfigurationManager().getConfigurationListForField(SolrConstants.PI);
    if (configItems != null && !configItems.isEmpty()) {
        Map<Object, String> replaceRules = configItems.get(0).getReplaceRules();
        if (replaceRules != null && !replaceRules.isEmpty()) {
            ret = MetadataHelper.applyReplaceRules(ret, replaceRules);
        }
    }
    ret = ret.replace(" ", "_");
    ret = ret.replace(",", "_");
    ret = ret.replace(":", "_");

    return ret;
}
 
開發者ID:intranda,項目名稱:goobi-viewer-indexer,代碼行數:30,代碼來源:MetadataHelper.java

示例5: getPlaylistByPlaylistId

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
@Override
public KalturaPlaylist getPlaylistByPlaylistId(String playlistId) {
    if (StringUtils.isEmpty(playlistId)) {
        throw new IllegalArgumentException("playlist id must be set");
    }
    KalturaPlaylist playlist = null;
    for (MediaCollection mc : mockCollections) {
        if (StringUtils.equals(mc.getId(), playlistId)) {
            playlist = makeSamplePlaylist(mc);
            break;
        }
    }
    return playlist;
}
 
開發者ID:ITYug,項目名稱:kaltura-ce-sakai-extension,代碼行數:15,代碼來源:KalturaAPIServiceStub.java

示例6: createFileListFromMultipleForm

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
    * Create file list from multiple form.
    *
    * @param multipleForm
    * @return
    */
   public static List<FormFile> createFileListFromMultipleForm(MultipleImagesForm multipleForm) {

List<FormFile> fileList = new ArrayList<FormFile>();
if (multipleForm.getFile1() != null && !StringUtils.isEmpty(multipleForm.getFile1().getFileName())) {
    fileList.add(multipleForm.getFile1());
}
if (multipleForm.getFile2() != null && !StringUtils.isEmpty(multipleForm.getFile2().getFileName())) {
    fileList.add(multipleForm.getFile2());
}
if (multipleForm.getFile3() != null && !StringUtils.isEmpty(multipleForm.getFile3().getFileName())) {
    fileList.add(multipleForm.getFile3());
}
if (multipleForm.getFile4() != null && !StringUtils.isEmpty(multipleForm.getFile4().getFileName())) {
    fileList.add(multipleForm.getFile4());
}
if (multipleForm.getFile5() != null && !StringUtils.isEmpty(multipleForm.getFile5().getFileName())) {
    fileList.add(multipleForm.getFile5());
}

return fileList;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:28,代碼來源:ImageGalleryUtils.java

示例7: findTagList

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
 * 查找指定配置項的標簽信息
 *
 * @param tagList
 * @param configItem
 * @return
 */
private static List<Tag> findTagList(List<Tag> tagList, BuildConfigItem configItem) {
    if (StringUtils.isEmpty(configItem.getConfigTags())) {
        return Collections.emptyList();
    }
    if (tagList == null || tagList.isEmpty()) {
        return Collections.emptyList();
    }

    List<Tag> itemTagList = new ArrayList<>();
    for (Tag tag : tagList) {
        for (String tagId : StringUtils.split(configItem.getConfigTags(), ",")) {
            if (tag.getId() == Integer.valueOf(tagId)) {
                itemTagList.add(tag);
            }
        }
    }
    return itemTagList;
}
 
開發者ID:zouzhirong,項目名稱:configx,代碼行數:26,代碼來源:ConfigRestService.java

示例8: build

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public void build(Object control, ViewComponent parentViewComponent) {
	TabControl tabControl = (TabControl) control;
	String id = tabControl.getId();
	ViewComponent component = this.generateViewComponent(id, TabControl.class);
	if (StringUtils.isEmpty(component.getId())) {
		component.setEnabled(false);
	}
	parentViewComponent.addChildren(component);
	List<Tab> tabs = tabControl.getTabs();
	for (Tab tab : tabs) {
		ViewComponent subViewComponent = null;
		String name = tab.getName();
		if (StringUtils.isNotEmpty(name)) {
			subViewComponent=this.generateViewComponent(name, tab.getClass());
			if(StringUtils.isNotEmpty(tab.getCaption())){
				subViewComponent.setDesc(tab.getCaption());
			}
		}else if(StringUtils.isNotEmpty(tab.getCaption())){
			subViewComponent=this.generateViewComponent(tab.getCaption(),tab.getClass());
		}
		if (subViewComponent!=null) {
			if(StringUtils.isEmpty(subViewComponent.getId())){
				subViewComponent.setEnabled(false);					
			}
			component.addChildren(subViewComponent);
		}
		if (tab instanceof ControlTab && subViewComponent!=null) {
			ControlTab controlTab = (ControlTab) tab;
			Control c = controlTab.getControl();
			for (IControlBuilder builder : builders) {
				if (builder.support(c)) {
					builder.build(c, subViewComponent);
					break;
				}
			}
		}
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:39,代碼來源:TabBuilder.java

示例9: fromJson

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
 * 反序列化POJO或簡單Collection如List<String>.
 * <p/>
 * 如果JSON字符串為Null或"null"字符串, 返回Null.
 * 如果JSON字符串為"[]", 返回空集合.
 * <p/>
 * 如需反序列化複雜Collection如List<MyBean>, 請使用fromJson(String, JavaType)
 *
 * @see #fromJson(String, JavaType)
 */
public <T> T fromJson(String jsonString, Class<T> clazz) {
    if (StringUtils.isEmpty(jsonString)) {
        return null;
    }

    try {
        return mapper.readValue(jsonString, clazz);
    } catch (IOException e) {
        logger.warn("parse json string error:" + jsonString, e);
        return null;
    }
}
 
開發者ID:fanqinghui,項目名稱:wish-pay,代碼行數:23,代碼來源:JsonMapper.java

示例10: uploadAttachment

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
@Override
   public Attachment uploadAttachment(FormFile uploadFile) throws PersistenceException {
if ((uploadFile == null) || StringUtils.isEmpty(uploadFile.getFileName())) {
    throw new ForumException("Could not find upload file: " + uploadFile);
}

NodeKey nodeKey = processFile(uploadFile);
Attachment file = new Attachment();
file.setFileUuid(nodeKey.getUuid());
file.setFileVersionId(nodeKey.getVersion());
file.setFileName(uploadFile.getFileName());

return file;
   }
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:ForumService.java

示例11: build

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public void build(Object control, ViewComponent parentViewComponent) {
	Menu menu = (Menu) control;
	String id = menu.getId();
	ViewComponent component = this.generateViewComponent(id, menu.getClass());
	if (StringUtils.isEmpty(id)) {
		component.setEnabled(false);
	}
	for (BaseMenuItem c : menu.getItems()) {
		buildBaseMenuItem(c, component);
	}
	parentViewComponent.addChildren(component);
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:13,代碼來源:MenuBuilder.java

示例12: build

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
public void build(Object control, ViewComponent parentViewComponent) {
	FormElement element = (FormElement) control;
	String id=element.getId();
	if(StringUtils.isEmpty(id)){
		id=element.getProperty();
	}
	if(StringUtils.isEmpty(id)){
		id = element.getLabel();
	}
	if (StringUtils.isEmpty(id)) {
		ViewElement viewElement = element.getParent();
		if (viewElement instanceof AutoForm) {
			EntityDataType entityDataType = ((AutoForm) viewElement).getDataType();
			Map<String, PropertyDef> dataTypePropertyDefs = null;
			if (entityDataType != null) {
				dataTypePropertyDefs = entityDataType.getPropertyDefs();
			}
			id = getFormElementLabel(element, dataTypePropertyDefs);
		}
	}
	
	ViewComponent component =generateViewComponent(id,element.getClass());
	if (StringUtils.isEmpty(id)) {
		component.setEnabled(false);
	}
	parentViewComponent.addChildren(component);

	Control c = element.getEditor();
	for (IControlBuilder builder : builders) {
		if (builder.support(c)) {
			builder.build(c, component);
			break;
		}
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:36,代碼來源:FormElementBuilder.java

示例13: digest

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
/**
 * Generate a base-64 encoded digest of the idPasswordPair pair
 * @param idPasswordPair id:password
 * @return a string that can be used for authentication
 */
public String digest(String idPasswordPair) throws IOException {
  if (StringUtils.isEmpty(idPasswordPair) || !isValid(idPasswordPair)) {
    throw new IOException("Invalid id:password: " + idPasswordPair);
  }
  try {
    return DigestAuthenticationProvider.generateDigest(idPasswordPair);
  } catch (NoSuchAlgorithmException e) {
    // unlikely since it is standard to the JVM, but maybe JCE restrictions
    // could trigger it
    throw new IOException(e.toString(), e);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:18,代碼來源:RegistrySecurity.java

示例14: getDataSourceName

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
protected String getDataSourceName(String dataSourcename){
	if(StringUtils.isEmpty(dataSourcename)){
		String currentDatasourceName=ContextHolder.getCurrentDataSourceName();
		if(StringUtils.isNotEmpty(getModuleFixDataSourceName())){
			currentDatasourceName=getModuleFixDataSourceName();
		}
		return currentDatasourceName;
	}else{
		return dataSourcename;
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:12,代碼來源:AbstractDao.java

示例15: getTransThreadNum

import org.apache.commons.lang.StringUtils; //導入方法依賴的package包/類
private int getTransThreadNum(Properties conf) {
    String numStr = conf.getProperty("totoro.cannal.trans.thread.nums");

    if (numStr == null || StringUtils.isEmpty(numStr.trim())) {
        return 3;
    }
    return Integer.valueOf(numStr);
}
 
開發者ID:zhongchengxcr,項目名稱:canal-elasticsearch,代碼行數:9,代碼來源:TotoroBootStrap.java


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