List of usage examples for org.apache.commons.beanutils ConvertUtils convert
public static String convert(Object value)
Convert the specified value into a String.
For more details see ConvertUtilsBean
.
From source file:net.servicefixture.converter.ObjectConverter.java
/** * Converts a object to string. */ public static String toString(Object object) { return ConvertUtils.convert(object); }
From source file:com.appleframework.jmx.core.management.ObjectAttribute.java
public String getEditableValue() { String attrValue = null;/*from www . ja v a2 s .c o m*/ if (getStatus() == STATUS_OK) { attrValue = ConvertUtils.convert(getValue()); if (attrValue == null) { return "null"; } } else if (getStatus() == ObjectAttribute.STATUS_NOT_FOUND) { // todo: this will not work for CLI attrValue = "<not found>"; } else { // todo: this will not work for CLI attrValue = "<error>"; } return attrValue; }
From source file:com.creactiviti.piper.core.MapObject.java
@Override public String getString(Object aKey) { Object value = get(aKey); return ConvertUtils.convert(value); }
From source file:com.iorga.webappwatcher.util.BasicParameterHandler.java
protected String convertToString(final V value) { return ConvertUtils.convert(value); }
From source file:net.shopxx.plugin.LoginPlugin.java
protected String joinKeyValue(Map<String, Object> map, String prefix, String suffix, String separator, boolean ignoreEmptyValue, String... ignoreKeys) { List<String> list = new ArrayList<String>(); if (map != null) { for (Map.Entry<String, Object> entry : map.entrySet()) { String key = entry.getKey(); String value = ConvertUtils.convert(entry.getValue()); if (StringUtils.isNotEmpty(key) && !ArrayUtils.contains(ignoreKeys, key) && (!ignoreEmptyValue || StringUtils.isNotEmpty(value))) { list.add(key + "=" + (value != null ? value : "")); }/* www .j a v a 2 s.c om*/ } } return (prefix != null ? prefix : "") + StringUtils.join(list, separator) + (suffix != null ? suffix : ""); }
From source file:net.shopxx.plugin.LoginPlugin.java
protected String joinValue(Map<String, Object> map, String prefix, String suffix, String separator, boolean ignoreEmptyValue, String... ignoreKeys) { List<String> list = new ArrayList<String>(); if (map != null) { for (Map.Entry<String, Object> entry : map.entrySet()) { String key = entry.getKey(); String value = ConvertUtils.convert(entry.getValue()); if (StringUtils.isNotEmpty(key) && !ArrayUtils.contains(ignoreKeys, key) && (!ignoreEmptyValue || StringUtils.isNotEmpty(value))) { list.add(value != null ? value : ""); }//from w w w . j a v a 2 s . c o m } } return (prefix != null ? prefix : "") + StringUtils.join(list, separator) + (suffix != null ? suffix : ""); }
From source file:com.expressui.core.util.ReflectionUtil.java
/** * Asks if the bean's properties are empty. boolean properties that are false and numbers * that are zero are considered empty. String values that are zero-length are considered empty. * All other property types must be null to be considered empty. * * @param bean bean to check//from w w w.j a va2 s . c o m * @return true if bean has no values */ public static boolean isBeanEmpty(Object bean) { if (bean == null) { return true; } WrapDynaBean wrapDynaBean = new WrapDynaBean(bean); DynaProperty[] properties = wrapDynaBean.getDynaClass().getDynaProperties(); for (DynaProperty property : properties) { String propertyName = property.getName(); Class propertyType = property.getType(); Object value = wrapDynaBean.get(propertyName); if (propertyType.isPrimitive()) { if (value instanceof Number && !value.toString().equals("0")) { return false; } else if (value instanceof Boolean && !value.toString().equals("false")) { return false; } else if (!value.toString().isEmpty()) { return false; } } else if (value != null) { if (!(value instanceof Collection)) { String convertedStringValue = ConvertUtils.convert(value); if (!StringUtil.isEmpty(convertedStringValue)) { return false; } } } } return true; }
From source file:com.dp2345.plugin.PaymentPlugin.java
/** * Map//from w ww.java 2 s. c o m * * @param map * Map * @param prefix * ? * @param suffix * ? * @param separator * * @param ignoreEmptyValue * * @param ignoreKeys * Key * @return */ protected String joinKeyValue(Map<String, Object> map, String prefix, String suffix, String separator, boolean ignoreEmptyValue, String... ignoreKeys) { List<String> list = new ArrayList<String>(); if (map != null) { for (Entry<String, Object> entry : map.entrySet()) { String key = entry.getKey(); String value = ConvertUtils.convert(entry.getValue()); if (StringUtils.isNotEmpty(key) && !ArrayUtils.contains(ignoreKeys, key) && (!ignoreEmptyValue || StringUtils.isNotEmpty(value))) { list.add(key + "=" + (value != null ? value : "")); } } } return (prefix != null ? prefix : "") + StringUtils.join(list, separator) + (suffix != null ? suffix : ""); }
From source file:info.magnolia.jcr.util.PropertiesImportExport.java
private String convertBinaryToExportString(Value value) throws RepositoryException { return "binary:" + ConvertUtils.convert(value.getString()); }
From source file:com.dp2345.plugin.PaymentPlugin.java
/** * Map//ww w.j a v a 2 s. c o m * * @param map * Map * @param prefix * ? * @param suffix * ? * @param separator * * @param ignoreEmptyValue * * @param ignoreKeys * Key * @return */ protected String joinValue(Map<String, Object> map, String prefix, String suffix, String separator, boolean ignoreEmptyValue, String... ignoreKeys) { List<String> list = new ArrayList<String>(); if (map != null) { for (Entry<String, Object> entry : map.entrySet()) { String key = entry.getKey(); String value = ConvertUtils.convert(entry.getValue()); if (StringUtils.isNotEmpty(key) && !ArrayUtils.contains(ignoreKeys, key) && (!ignoreEmptyValue || StringUtils.isNotEmpty(value))) { list.add(value != null ? value : ""); } } } return (prefix != null ? prefix : "") + StringUtils.join(list, separator) + (suffix != null ? suffix : ""); }