本文整理匯總了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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}
}
}
示例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;
}
}
示例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;
}
示例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);
}
示例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;
}
}
}
示例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);
}
}
示例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;
}
}
示例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);
}