List of usage examples for org.apache.commons.beanutils BeanMap BeanMap
public BeanMap(Object bean)
BeanMap
�作指定的bean, 如果给定的bean是null
, 那么 这个map将会是empty。 From source file:com.creditcloud.ump.model.ump.utils.MessageUtils.java
public static Map<String, String> getFieldValuesMap(BaseRequest request) { Map<String, String> result = new HashMap<>(); Set set = new BeanMap(request).entrySet(); for (Object entryObj : set) { Map.Entry entry = (Map.Entry) entryObj; String key = entry.getKey().toString(); String value = entry.getValue() == null ? null : entry.getValue().toString(); if (!key.equalsIgnoreCase("class")) { // not put null field if (value != null) { value = key.equals("service") ? value.toLowerCase() : value; result.put(key, value);// w ww . j av a 2s . c o m } } } return result; }
From source file:com.enonic.cms.business.core.security.userstore.connector.remote.plugin.RemoteUserStoreFactory.java
public RemoteUserStorePlugin create(String type, Properties props) { RemoteUserStorePlugin userStorePlugin = createInstance(type); if (props != null) { BeanMap bean = new BeanMap(userStorePlugin); for (Object key : props.keySet()) { String strKey = key.toString(); String strValue = props.getProperty(strKey); // Preventing this property to be set as false if it blank (since it will be confusing for the user) if ("readUserSyncAttributeAsBinary".equals(strKey) && StringUtils.isBlank(strValue)) { continue; }/*from www .j ava2s.c om*/ try { bean.put(strKey, strValue); } catch (Exception e) { LOG.warn("Failed to set property [" + strKey + "] with value [" + strValue + "]."); } } } return userStorePlugin; }
From source file:com.autobizlogic.abl.util.BeanUtil.java
/** * Get a short string describing the given bean, in the form EntityName[primary-key] */// w w w. j ava2 s .co m @SuppressWarnings("rawtypes") public static String getBeanDescription(MetaEntity metaEntity, Object bean) { Map map = null; if (bean instanceof Map) map = (Map) bean; else map = new BeanMap(bean); String pkPropName = metaEntity.getIdentifierName(); if (pkPropName != null) { Object pk = map.get(pkPropName); return metaEntity.getEntityName() + "[" + pk.toString() + "]"; } return metaEntity.getEntityName() + "[composite key]"; }
From source file:com.googlecode.commons.swing.value.GenericValueGetterSetter.java
public Object getValue(Component component) { BeanMap map = new BeanMap(component); return map.get(getterName); }
From source file:com.googlecode.commons.swing.value.GenericValueGetterSetter.java
public void setValue(Component component, Object value) { BeanMap map = new BeanMap(component); map.put(setterName, value); }
From source file:iing.uabc.edu.mx.persistencia.util.BeanManager.java
public BeanManager(T instance) { bean = new BeanMap(instance); }
From source file:com.bstek.dorado.view.loader.PackagesConfigPatternParser.java
@Override @SuppressWarnings("unchecked") protected Object doParse(Node node, ParseContext context) throws Exception { Element element = (Element) node; String name = element.getAttribute("name"); Assert.notEmpty(name);/*from w w w. j a v a2s . c o m*/ Pattern pattern = new Pattern(name); Map<String, Object> properties = parseProperties(element, context); ((Map<String, Object>) new BeanMap(pattern)).putAll(properties); return pattern; }
From source file:com.trickl.crawler.handle.BeanMemberHandler.java
@SuppressWarnings("unchecked") @Override// ww w . java2s . c om public void handle(T task, BeanType bean) throws DroidsException, IOException { if (task == null || bean == null) throw new NullPointerException(); if (outputHandler != null) { BeanMap beanMap = new BeanMap(bean); BeanMemberType beanMember = (BeanMemberType) beanMap.get(propertyName); if (beanMember == null) { throw new DroidsException("Bean does not contain a value for member '" + propertyName + "'"); } outputHandler.handle(task, beanMember); } }
From source file:iing.uabc.edu.mx.persistencia.util.BeanManager.java
private void setBeanClass(Class<T> beanClass) { try {/*from www . jav a 2 s. com*/ T instance = beanClass.newInstance(); bean = new BeanMap(instance); } catch (InstantiationException | IllegalAccessException ex) { Logger.getLogger(BeanManager.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:io.lightlink.excel.StreamingExcelExporter.java
public StreamingExcelExporter(URL template, Object data) { this.data = data instanceof Map ? (Map) data : new BeanMap(data); this.template = template; }